MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__high_bit

Function stbi__high_bit

Source/Utils/stb_image.h:5367–5377  ·  view source on GitHub ↗

returns 0..31 for the highest set bit

Source from the content-addressed store, hash-verified

5365
5366// returns 0..31 for the highest set bit
5367static int stbi__high_bit(unsigned int z)
5368{
5369 int n=0;
5370 if (z == 0) return -1;
5371 if (z >= 0x10000) { n += 16; z >>= 16; }
5372 if (z >= 0x00100) { n += 8; z >>= 8; }
5373 if (z >= 0x00010) { n += 4; z >>= 4; }
5374 if (z >= 0x00004) { n += 2; z >>= 2; }
5375 if (z >= 0x00002) { n += 1;/* >>= 1;*/ }
5376 return n;
5377}
5378
5379static int stbi__bitcount(unsigned int a)
5380{

Callers 1

stbi__bmp_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected