core/crc: Fix the 64 bits implementation
We used 1ULL at one place and not the other ... at the same time,
we now use (uintXX_t) so that the proper type is used each time.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/src/crcXXgen.c.tpl b/src/crcXXgen.c.tpl
index 80bf1e2..2a4bf21 100644
--- a/src/crcXXgen.c.tpl
+++ b/src/crcXXgen.c.tpl
@@ -53,13 +53,13 @@
for (i=0; i<len; i++) {
uintXX_t bit = in[i] & 1;
crc ^= (bit << n);
- if (crc & (1 << n)) {
+ if (crc & ((uintXX_t)1 << n)) {
crc <<= 1;
crc ^= poly;
} else {
crc <<= 1;
}
- crc &= (1ULL << code->bits) - 1;
+ crc &= ((uintXX_t)1 << code->bits) - 1;
}
crc ^= code->remainder;