MCPcopy Create free account
hub / github.com/DentonW/DevIL / CountBitsFromMask

Function CountBitsFromMask

DevIL/src-IL/src/il_dds.cpp:1765–1781  ·  view source on GitHub ↗

This function simply counts how many contiguous bits are in the mask.

Source from the content-addressed store, hash-verified

1763
1764// This function simply counts how many contiguous bits are in the mask.
1765ILuint CountBitsFromMask(ILuint Mask)
1766{
1767 ILuint i, TestBit = 0x01, Count = 0;
1768 ILboolean FoundBit = IL_FALSE;
1769
1770 for (i = 0; i < 32; i++, TestBit <<= 1) {
1771 if (Mask & TestBit) {
1772 if (!FoundBit)
1773 FoundBit = IL_TRUE;
1774 Count++;
1775 }
1776 else if (FoundBit)
1777 return Count;
1778 }
1779
1780 return Count;
1781}
1782
1783
1784// Same as DecompressARGB, but it works on images with more than 8 bits

Callers 1

DecompressARGB16Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected