trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jplev...@apache.org
Subject svn commit: r1092785 - /trafficserver/traffic/trunk/lib/ts/ink_queue.h
Date Fri, 15 Apr 2011 18:45:15 GMT
Author: jplevyak
Date: Fri Apr 15 18:45:15 2011
New Revision: 1092785

URL: http://svn.apache.org/viewvc?rev=1092785&view=rev
Log:
Fix a potential issue in the way freelist pointer version are
encoded which might have effects for very large virtual memory
machines.

Modified:
    trafficserver/traffic/trunk/lib/ts/ink_queue.h

Modified: trafficserver/traffic/trunk/lib/ts/ink_queue.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_queue.h?rev=1092785&r1=1092784&r2=1092785&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_queue.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_queue.h Fri Apr 15 18:45:15 2011
@@ -110,10 +110,11 @@ extern "C"
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
 (_x).s.pointer = _p; (_x).s.version = _v
 #elif defined(__x86_64__)
-#define FREELIST_POINTER(_x) ((void*)(((((intptr_t)(_x).data)>>63)<<48)|(((intptr_t)(_x).data)&0xFFFFFFFFFFFFLL)))
-#define FREELIST_VERSION(_x) ((((intptr_t)(_x).data)<<1)>>49)
+#define FREELIST_POINTER(_x) ((void*)(((((intptr_t)(_x).data)<<16)>>16) | \
+ (((~((((intptr_t)(_x).data)<<16>>63)-1))>>48)<<48)))  // sign extend
+#define FREELIST_VERSION(_x) (((intptr_t)(_x).data)>>48)
 #define SET_FREELIST_POINTER_VERSION(_x,_p,_v) \
-  (_x).data = ((((intptr_t)(_p))&0x8000FFFFFFFFFFFFLL) | (((_v)&0x7FFFLL) <<
48))
+  (_x).data = ((((intptr_t)(_p))&0x0000FFFFFFFFFFFFULL) | (((_v)&0xFFFFULL) <<
48))
 #else
 #error "unsupported processor"
 #endif



Mime
View raw message