mirror of
https://github.com/ipxe/ipxe
synced 2025-12-28 18:42:53 +03:00
Don't get stuck in an infinite loop on negative integers!
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
int __flsl ( long x ) {
|
int __flsl ( long x ) {
|
||||||
int r = 0;
|
unsigned long value = x;
|
||||||
|
int ls = 0;
|
||||||
|
|
||||||
for ( r = 0 ; x ; r++ ) {
|
for ( ls = 0 ; value ; ls++ ) {
|
||||||
x >>= 1;
|
value >>= 1;
|
||||||
}
|
}
|
||||||
return r;
|
return ls;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user