I knocked another second off by condensing all the temporary variables into a one liner.
Anyone see anything else at all to do here? The unsigned macro just caps it back to 32 bits after shifting up (cpu shift would discard bits that go off the end, python grows them).
crctab is just the polynomial as a lookup table of 256 32 bit y=f(x) results.
Anyone see anything else at all to do here? The unsigned macro just caps it back to 32 bits after shifting up (cpu shift would discard bits that go off the end, python grows them).
crctab is just the polynomial as a lookup table of 256 32 bit y=f(x) results.
UNSIGNED = lambda n: n & 0xffffffff def crc32p(b): crc = 0 for c in b: crc = (UNSIGNED(crc << 8) ^ (crctab[( (crc>>24) ^ c )])) return crc^0xFFFFFFFF #some crc need a final xor, mine does.4.3 sec / M.