mirror of
https://github.com/wader/fq.git
synced 2025-01-05 12:26:11 +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
|
type Table [256]uint
|
||||||
|
|
||||||
func MakeTable(poly int, bits int) Table {
|
func MakeTable(poly uint, bits int) Table {
|
||||||
table := [256]uint{}
|
table := [256]uint{}
|
||||||
mask := uint((1 << bits) - 1)
|
mask := uint((1 << bits) - 1)
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ func MakeTable(poly int, bits int) Table {
|
|||||||
crc := uint(i << (bits - 8))
|
crc := uint(i << (bits - 8))
|
||||||
for j := 0; j < 8; j++ {
|
for j := 0; j < 8; j++ {
|
||||||
if crc&(1<<(bits-1)) != 0 {
|
if crc&(1<<(bits-1)) != 0 {
|
||||||
crc = ((crc << 1) ^ uint(poly)) & mask
|
crc = ((crc << 1) ^ poly) & mask
|
||||||
} else {
|
} else {
|
||||||
crc = (crc << 1) & mask
|
crc = (crc << 1) & mask
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user