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>
This commit is contained in:
Sylvain Munaut 2013-02-01 20:37:03 +01:00
parent 49f4e5be9f
commit 9adfda2ca3
1 changed files with 2 additions and 2 deletions

View File

@ -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;