Re: The open letter to Derick Rethans <derick@php.net>
| From: | Alexander Valyalkin | Date: | Wed, 16 Jun 2004 16:45:21 +0000 |
| Subject: | Re: The open letter to Derick Rethans <derick@php.net> | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10530@lists.php.net to get a copy of this message | ||
On Wed, 16 Jun 2004 16:35:04 +0200, Ard Biesheuvel <abies@php.net> wrote:
Alexander Valyalkin wrote:Your answer is excellent! Thank you for good explanation of my fault. -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/On Wed, 16 Jun 2004 12:03:36 +0200, Ard Biesheuvel <abies@php.net> wrote: Have you tested my initial re-implementation of crc32() on 64-bit architectures?No, but I don't have to:register unsigned long int crc = ~0ul;... so crc = 0xffffffffffffffffdo { crc = (crc >> 8) ^ crc32tab[(crc ^ *p++) & 0xff]; n--; } while (n);... which is xor'ed with crc32tab, which has 0x00000000 in the upper halves of all its elements. This leads to the following a) the returned CRC is larger than 32 bits in the first 4 iterations,leading to incorrect results for strings of length up to 3;b) in the first couple of iterations, 1's have been shifted in insteadof 0's, leading to incorrect results for strings of length 3 and up.Which means it still works for all strings of length zero. How's that for a BC break ?