Fix too-large shift in mceliece*f

This commit is contained in:
Thom Wiggers 2020-03-13 13:27:02 -04:00
parent 5aeccdb747
commit 85de23bdfe
No known key found for this signature in database
GPG Key ID: 001BB0A7CE26E363
2 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ static inline int ctz(uint64_t in) {
int i, b, m = 0, r = 0; int i, b, m = 0, r = 0;
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
b = ((int)in >> i) & 1; b = ((int)(in >> i)) & 1;
m |= b; m |= b;
r += (m ^ 1) & (b ^ 1); r += (m ^ 1) & (b ^ 1);
} }

View File

@ -57,7 +57,7 @@ static inline int ctz(uint64_t in) {
int i, b, m = 0, r = 0; int i, b, m = 0, r = 0;
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
b = ((int)in >> i) & 1; b = ((int)(in >> i)) & 1;
m |= b; m |= b;
r += (m ^ 1) & (b ^ 1); r += (m ^ 1) & (b ^ 1);
} }