Merge branch 'fix_vorbis_ilog' of https://github.com/rygorous/stb into working
This commit is contained in:
commit
66fdbaaa87
@ -986,6 +986,8 @@ static int ilog(int32 n)
|
||||
{
|
||||
static signed char log2_4[16] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4 };
|
||||
|
||||
if (n < 0) return 0; // signed n returns 0
|
||||
|
||||
// 2 compares if n < 16, 3 compares otherwise (4 if signed or n > 1<<29)
|
||||
if (n < (1 << 14))
|
||||
if (n < (1 << 4)) return 0 + log2_4[n ];
|
||||
@ -995,8 +997,7 @@ static int ilog(int32 n)
|
||||
if (n < (1 << 19)) return 15 + log2_4[n >> 15];
|
||||
else return 20 + log2_4[n >> 20];
|
||||
else if (n < (1 << 29)) return 25 + log2_4[n >> 25];
|
||||
else if (n < (1 << 31)) return 30 + log2_4[n >> 30];
|
||||
else return 0; // signed n returns 0
|
||||
else return 30 + log2_4[n >> 30];
|
||||
}
|
||||
|
||||
#ifndef M_PI
|
||||
|
Loading…
Reference in New Issue
Block a user