MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / FindLSBSet

Function FindLSBSet

extern/re2/re2/prog.cc:921–940  ·  view source on GitHub ↗

Finds the least significant non-zero bit in n.

Source from the content-addressed store, hash-verified

919#if defined(__AVX2__)
920// Finds the least significant non-zero bit in n.
921static int FindLSBSet(uint32_t n) {
922 DCHECK_NE(n, 0);
923#if defined(__GNUC__)
924 return __builtin_ctz(n);
925#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
926 unsigned long c;
927 _BitScanForward(&c, n);
928 return static_cast<int>(c);
929#else
930 int c = 31;
931 for (int shift = 1 << 4; shift != 0; shift >>= 1) {
932 uint32_t word = n << shift;
933 if (word != 0) {
934 n = word;
935 c -= shift;
936 }
937 }
938 return c;
939#endif
940}
941#endif
942
943const void* Prog::PrefixAccel_FrontAndBack(const void* data, size_t size) {

Callers 2

FindNextSetBitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected