mirror of
https://github.com/wader/fq.git
synced 2024-09-11 12:05:39 +03:00
crc: Unbreak build on 32-bit arch
Thanks Alexey Dokuchaev @danfe for report and fix. Fixes #30
This commit is contained in:
parent
5513dc0263
commit
46b59d0ebf
@ -8,7 +8,7 @@ import (
|
||||
|
||||
type Table [256]uint
|
||||
|
||||
func MakeTable(poly int, bits int) Table {
|
||||
func MakeTable(poly uint, bits int) Table {
|
||||
table := [256]uint{}
|
||||
mask := uint((1 << bits) - 1)
|
||||
|
||||
@ -17,7 +17,7 @@ func MakeTable(poly int, bits int) Table {
|
||||
crc := uint(i << (bits - 8))
|
||||
for j := 0; j < 8; j++ {
|
||||
if crc&(1<<(bits-1)) != 0 {
|
||||
crc = ((crc << 1) ^ uint(poly)) & mask
|
||||
crc = ((crc << 1) ^ poly) & mask
|
||||
} else {
|
||||
crc = (crc << 1) & mask
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user