diff options
author | Rob Landley <rob@landley.net> | 2017-05-21 13:11:42 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2017-05-21 13:11:42 -0500 |
commit | f86f2f4e9a20d235b24ea86e4dddd0485165306f (patch) | |
tree | 83e2341019727a29ef59210926e6c83e15ccd146 /lib/lib.c | |
parent | 83b3531ec2876fa76817501bf1a38d4438ac39e6 (diff) | |
download | toybox-f86f2f4e9a20d235b24ea86e4dddd0485165306f.tar.gz |
Cleaup chrt
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -512,6 +512,16 @@ void msleep(long miliseconds) nanosleep(&ts, &ts); } +// return 1<<x of highest bit set +int highest_bit(unsigned long l) +{ + int i; + + for (i = 0; l; i++) l >>= 1; + + return i-1; +} + // Inefficient, but deals with unaligned access int64_t peek_le(void *ptr, unsigned size) { |