Commit bf26db91 authored by Josh Coalson's avatar Josh Coalson
Browse files

add wide version of silog2

parent 881a36d0
......@@ -98,3 +98,27 @@ unsigned FLAC__bitmath_silog2(int v)
}
}
}
unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v)
{
while(1) {
if(v == 0) {
return 0;
}
else if(v > 0) {
unsigned l = 0;
while(v) {
l++;
v >>= 1;
}
return l+1;
}
else if(v == -1) {
return 2;
}
else {
v++;
v = -v;
}
}
}
......@@ -24,5 +24,6 @@
unsigned FLAC__bitmath_ilog2(unsigned v);
unsigned FLAC__bitmath_silog2(int v);
unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment