Commit 8e695300 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

[buddy] fix an undefined behavior

* src/prime.c (BitIsSet): Do not shift signed
int by 31 places; shift unsigned int instead.
parent fcd67831
......@@ -43,7 +43,7 @@
#define Random(i) ( (rand() % (i)) + 1 )
#define isEven(src) (!((src) & 0x1))
#define hasFactor(src,n) ( (((src)!=(n)) && ((src)%(n) == 0)) )
#define BitIsSet(src,b) ( ((src) & (1<<(b))) != 0 )
#define BitIsSet(src,b) ( ((src) & (1U<<(b))) != 0 )
#define CHECKTIMES 20
......@@ -318,4 +318,3 @@ int main()
/* EOF */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment