43 lines
498 B
NASM
43 lines
498 B
NASM
.data
|
|
intout: .string "0x%08x\n"
|
|
|
|
CRC32POLY: .long 0x04C11DB7
|
|
|
|
datastream: .long 1,0,0,0,1,1,0,1
|
|
databits: .long 8
|
|
|
|
.text
|
|
.globl main
|
|
|
|
main:
|
|
movl $0, %eax
|
|
movl $0 , %ecx
|
|
L1:
|
|
|
|
movl %eax , %ebx
|
|
and $0x80000000 , %ebx
|
|
shrl $31 , %ebx
|
|
movl %ecx , %esi
|
|
cmpl %ebx , datastream(,%esi,4)
|
|
je equal
|
|
|
|
shll $1 , %eax
|
|
xor CRC32POLY , %eax
|
|
jmp goAhead
|
|
|
|
equal:
|
|
shll $1 , %eax
|
|
|
|
goAhead:
|
|
inc %ecx
|
|
cmpl databits, %ecx
|
|
jne L1
|
|
|
|
pushl %eax
|
|
pushl $intout
|
|
call printf
|
|
|
|
.Exit:
|
|
movl $1, %eax
|
|
int $0x80
|