diff options
author | Josh Coalson <jcoalson@users.sourceforce.net> | 2004-11-09 01:22:35 +0000 |
---|---|---|
committer | Josh Coalson <jcoalson@users.sourceforce.net> | 2004-11-09 01:22:35 +0000 |
commit | 375810ebdd8c56d8d5c3bc64a3054363c1e6ce60 (patch) | |
tree | 1d01f2edbead16e2f6ec634aaf9e81caadcdfe86 /src/libFLAC/bitmath.c | |
parent | 2757af6c1d5fe20459b3c46c9f42a536e9118427 (diff) | |
download | flac-375810ebdd8c56d8d5c3bc64a3054363c1e6ce60.tar.gz |
add FLAC__bitmath_ilog2_wide()
Diffstat (limited to 'src/libFLAC/bitmath.c')
-rw-r--r-- | src/libFLAC/bitmath.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libFLAC/bitmath.c b/src/libFLAC/bitmath.c index 5ace20b9..6b4912ea 100644 --- a/src/libFLAC/bitmath.c +++ b/src/libFLAC/bitmath.c @@ -54,7 +54,16 @@ * ilog2(17) = 4 * ilog2(18) = 4 */ -unsigned FLAC__bitmath_ilog2(unsigned v) +unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) +{ + unsigned l = 0; + FLAC__ASSERT(v > 0); + while(v >>= 1) + l++; + return l; +} + +unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) { unsigned l = 0; FLAC__ASSERT(v > 0); |