diff options
author | Michael Brown | 2007-09-16 18:36:40 +0200 |
---|---|---|
committer | Michael Brown | 2007-09-21 02:14:38 +0200 |
commit | db124b12551f91a2437014fb74a122ff0d0db08b (patch) | |
tree | 352f99fc9e49162862b46a7a598eb4550209593f /src/core/bitops.c | |
parent | Moved iobuf.h assertions outside the static inline functions, so that (diff) | |
download | ipxe-db124b12551f91a2437014fb74a122ff0d0db08b.tar.gz ipxe-db124b12551f91a2437014fb74a122ff0d0db08b.tar.xz ipxe-db124b12551f91a2437014fb74a122ff0d0db08b.zip |
Add fls() for non-constant values.
Diffstat (limited to 'src/core/bitops.c')
-rw-r--r-- | src/core/bitops.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/bitops.c b/src/core/bitops.c new file mode 100644 index 00000000..75d57bf9 --- /dev/null +++ b/src/core/bitops.c @@ -0,0 +1,10 @@ +#include <strings.h> + +int __flsl ( long x ) { + int r = 0; + + for ( r = 0 ; x ; r++ ) { + x >>= 1; + } + return r; +} |