mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 17:33:50 +01:00
crc: Use type cast in crc32_ieee_base to avoid undefined behavior
Change-Id: I8362831125927372c62ecb5eec2f5afe6f75ef24 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
636272cff6
commit
5c62f1e1ec
@ -165,7 +165,7 @@ uint32_t crc32_ieee_base(uint32_t seed, uint8_t * buf, uint64_t len)
|
||||
uint32_t poly = 0x04C11DB7; // IEEE standard
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
rem = rem ^ (buf[i] << 24);
|
||||
rem = rem ^ ((uint64_t) buf[i] << 24);
|
||||
for (j = 0; j < MAX_ITER; j++) {
|
||||
rem = rem << 1;
|
||||
rem = (rem & 0x100000000ULL) ? rem ^ poly : rem;
|
||||
|
Loading…
Reference in New Issue
Block a user