MCPcopy Create free account
hub / github.com/F-Stack/f-stack / BIT_highbit32

Function BIT_highbit32

freebsd/contrib/openzfs/module/zstd/lib/zstd.c:1435–1460  ·  view source on GitHub ↗

-************************************************************** * Internal functions ****************************************************************/

Source from the content-addressed store, hash-verified

1433* Internal functions
1434****************************************************************/
1435MEM_STATIC unsigned BIT_highbit32 (U32 val)
1436{
1437 assert(val != 0);
1438 {
1439# if defined(_MSC_VER) /* Visual */
1440 unsigned long r=0;
1441 return _BitScanReverse ( &r, val ) ? (unsigned)r : 0;
1442# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
1443 return __builtin_clz (val) ^ 31;
1444# elif defined(__ICCARM__) /* IAR Intrinsic */
1445 return 31 - __CLZ(val);
1446# else /* Software version */
1447 static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29,
1448 11, 14, 16, 18, 22, 25, 3, 30,
1449 8, 12, 20, 28, 15, 17, 24, 7,
1450 19, 27, 23, 6, 26, 5, 4, 31 };
1451 U32 v = val;
1452 v |= v >> 1;
1453 v |= v >> 2;
1454 v |= v >> 4;
1455 v |= v >> 8;
1456 v |= v >> 16;
1457 return DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
1458# endif
1459 }
1460}
1461
1462/*===== Local Constants =====*/
1463static const unsigned BIT_mask[] = {

Callers 9

BIT_initDStreamFunction · 0.70
HUF_readStatsFunction · 0.70
FSE_buildDTableFunction · 0.70
FSE_buildCTable_wkspFunction · 0.70
FSE_minTableLogFunction · 0.70
HUF_setMaxHeightFunction · 0.70
HUF_sortFunction · 0.70
ZSTD_buildFSETableFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected