MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / clz32

Function clz32

cmp_compressonatorlib/astc/astc_encode_kernel.cpp:8027–8042  ·  view source on GitHub ↗

32-bit count-leading-zeroes function: use the Assembly instruction whenever possible. */

Source from the content-addressed store, hash-verified

8025
8026/* 32-bit count-leading-zeroes function: use the Assembly instruction whenever possible. */
8027uint32_t clz32(uint32_t inp)
8028{
8029 /* slow default version */
8030 uint32_t summa = 24;
8031 if (inp >= (uint32_t)(0x10000))
8032 {
8033 inp >>= 16;
8034 summa -= 16;
8035 }
8036 if (inp >= (uint32_t)(0x100))
8037 {
8038 inp >>= 8;
8039 summa -= 8;
8040 }
8041 return summa + clz_table[inp];
8042}
8043
8044/* convert from FP16 to FP32. */
8045CGU_UINT sf16_to_sf32(CGU_SHORT inp)

Callers 2

sf16_to_sf32Function · 0.70
unorm16_to_sf16Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected