mirror of https://gerrit.osmocom.org/libosmocore
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:
parent
49f4e5be9f
commit
9adfda2ca3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue