MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__bitcount

Function stbi__bitcount

include/stb/stb_image.h:5382–5390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5380}
5381
5382static int stbi__bitcount(unsigned int a)
5383{
5384 a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2
5385 a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4
5386 a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits
5387 a = (a + (a >> 8)); // max 16 per 8 bits
5388 a = (a + (a >> 16)); // max 32 per 8 bits
5389 return a & 0xff;
5390}
5391
5392// extract an arbitrarily-aligned N-bit value (N=bits)
5393// from v, and then make it 8-bits long and fractionally

Callers 1

stbi__bmp_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected