Changeset 7170
- Timestamp:
- Jun 10, 2009, 12:56:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/utilities/system_tools.py
r7148 r7170 244 244 """64 bit safe crc computation. 245 245 246 See Guido's 64 bit fix at http://bugs.python.org/issue1202 246 See http://docs.python.org/library/zlib.html#zlib.crc32: 247 248 To generate the same numeric value across all Python versions 249 and platforms use crc32(data) & 0xffffffff. 247 250 """ 248 251 249 252 from zlib import crc32 250 import os 251 252 x = crc32(string) 253 254 if os.name == 'posix' and os.uname()[4] in ['x86_64', 'ia64']: 255 crcval = x - ((x & 0x80000000) << 1) 256 else: 257 crcval = x 258 259 return crcval 253 254 return crc32(string) & 0xffffffff 260 255 261 256
Note: See TracChangeset
for help on using the changeset viewer.