summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2013-02-01 20:37:03 +0100
committerSylvain Munaut <tnt@246tNt.com>2013-02-01 20:37:03 +0100
commit9adfda2ca30f19858ca272e0ee99b3ff3ff62a93 (patch)
tree6065be6f6d65d2dc14b0dc7381eb38c6fd51a44a /src
parent49f4e5be9fba5c27cce228c198e13ab55b740782 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/crcXXgen.c.tpl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crcXXgen.c.tpl b/src/crcXXgen.c.tpl
index 80bf1e2a..2a4bf213 100644
--- a/src/crcXXgen.c.tpl
+++ b/src/crcXXgen.c.tpl
@@ -53,13 +53,13 @@ osmo_crcXXgen_compute_bits(const struct osmo_crcXXgen_code *code,
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;