add FLAC__bitmath_ilog2_wide()
authorJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 9 Nov 2004 01:22:35 +0000 (01:22 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 9 Nov 2004 01:22:35 +0000 (01:22 +0000)
src/libFLAC/bitmath.c
src/libFLAC/include/private/bitmath.h

index 5ace20b..6b4912e 100644 (file)
  * 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);
index ce4eeaa..6e39ecc 100644 (file)
@@ -34,7 +34,8 @@
 
 #include "FLAC/ordinals.h"
 
-unsigned FLAC__bitmath_ilog2(unsigned v);
+unsigned FLAC__bitmath_ilog2(FLAC__uint32 v);
+unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v);
 unsigned FLAC__bitmath_silog2(int v);
 unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v);