note 78232 added to function.crc32

From: Date: Wed, 03 Oct 2007 18:53:47 +0000
Subject: note 78232 added to function.crc32
Groups: php.notes 
Request: Send a blank email to php-notes+get-131048@lists.php.net to get a copy of this message
Dealing with 32 bit unsigned values overflowing 32 bit php signed values can be done by adding 0x10000000 to any unexpected negative result, rather than using sprintf. $i = crc32('1'); printf("%u\n", $i); if (0 > $i) { // Implicitly casts i as float, and corrects this sign. $i += 0x100000000; } var_dump($i); Outputs: 2212294583 float(2212294583) ---- Server IP: 194.145.210.3 Probable Submitter: 82.3.16.111 ---- Manual Page -- http://www.php.net/manual/en/function.crc32.php Edit -- https://master.php.net/note/edit/78232 Del: integrated -- https://master.php.net/note/delete/78232/integrated Del: useless -- https://master.php.net/note/delete/78232/useless Del: bad code -- https://master.php.net/note/delete/78232/bad+code Del: spam -- https://master.php.net/note/delete/78232/spam Del: non-english -- https://master.php.net/note/delete/78232/non-english Del: in docs -- https://master.php.net/note/delete/78232/in+docs Del: other reasons-- https://master.php.net/note/delete/78232 Reject -- https://master.php.net/note/reject/78232 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131048) next »