Edit report at https://bugs.php.net/bug.php?id=36306&edit=1
ID: 36306 Updated by: [email protected] Reported by: anight at eyelinkmedia dot com Summary: crc32() function result differs on 32-bit and 64-bit platforms -Status: Closed +Status: Wont fix Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: independant PHP Version: 4.4.2 Assigned To: pajoye Block user comment: N Private report: N New Comment: the fix was actually reverted, see http://php.net/crc32 for further details ... Previous Comments: ------------------------------------------------------------------------ [2006-02-07 01:27:09] [email protected] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2006-02-06 18:34:27] anight at eyelinkmedia dot com Description: ------------ I noticed that crc32() function result is represented differently on 32-bit and 64-bit platforms. The problem is whithin crc32.c file, unsigned int crc = ~0; After actual crc32 calculations result is inverted and then casted to "long": RETVAL_LONG(~crc); Proposed patch: RETVAL_LONG(~ (long) crc); I tested it successfully on 64-bit linux and macosx, it works well. Reproduce code: --------------- <? echo crc32("platform independant") . "\n"; ?> Expected result: ---------------- I expect to see value -858128794 both on 32-bit and 64-bit platform. Actual result: -------------- On 64-bit platform i see 3436838502 On 32-bit -858128794 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=36306&edit=1
