Re: CRC32 - as good as 32bit checksums get?




Bartosz Wójcik wrote:
On Mon, 26 Jun 2006 22:24:39 +0800, Dave -Turner wrote:

is CRC32 still the best 32bit checksum out there, and could there ever be a
better 32bit checksum?

ps. does anyone have a url or source for a crc64 implementation in an
assembly language?

did you mean crc32?

;
; MASM syntax

..... WHY!!!?!?!!

You must be one of them "hackers" I hear about...

..L8:
movl %eax, %esi
xorb (%rdi), %al
decq %rcx
shrl $8, %esi
incq %rdi
movzbl %al, %edx
xorl crctab(,%rdx,4), %esi
cmpq $-1, %rcx
movl %esi, %eax
jne .L8

oooh, and if I turn on loop unrolling I get

..L10:
movzbl (%rdi), %edx
movl %ecx, %r10d
movzbl 3(%rdi), %eax
shrl $8, %r10d
subq $4, %rsi
xorl %ecx, %edx
movzbl 1(%rdi), %ecx
movzbl %dl, %r11d
movzbl 2(%rdi), %edx
addq $4, %rdi
xorl crctab(,%r11,4), %r10d
xorl %r10d, %ecx
movl %r10d, %r8d
movzbl %cl, %r9d
shrl $8, %r8d
xorl crctab(,%r9,4), %r8d
xorl %r8d, %edx
movl %r8d, %r11d
movzbl %dl, %ecx
shrl $8, %r11d
xorl crctab(,%rcx,4), %r11d
xorl %r11d, %eax
movl %r11d, %ecx
movzbl %al, %r10d
shrl $8, %ecx
xorl crctab(,%r10,4), %ecx
cmpq $-1, %rsi
jne .L10

Wonders never cease...

CRCs are so trivial that posting assembler, specially x86 assembler is
just childish. I could see if this was an 8051 or something but in 3
seconds with a C compiler I could accomplish the same thing you got
with your routine which while only taking you 5 mins to write still
takes 5 mins...

Tom

.