[libc] Add inline assembly implementation of flsl() using BSR instruction

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2014-04-24 14:49:08 +01:00
parent 8f0e0e1356
commit dce7107fc0
3 changed files with 33 additions and 15 deletions

View File

@@ -1,13 +0,0 @@
#include <strings.h>
FILE_LICENCE ( GPL2_OR_LATER );
int __flsl ( long x ) {
unsigned long value = x;
int ls = 0;
for ( ls = 0 ; value ; ls++ ) {
value >>= 1;
}
return ls;
}