MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / WhichPowerOf2

Function WhichPowerOf2

Bcore/src/main/cpp/base/bit_utils.h:151–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149
150template<typename T>
151constexpr int WhichPowerOf2(T x) {
152 static_assert(std::is_integral<T>::value, "T must be integral");
153 // TODO: assert unsigned. There is currently many uses with signed values.
154 DCHECK((x != 0) && IsPowerOfTwo(x));
155 return CTZ(x);
156}
157
158// For rounding integers.
159// Note: Omit the `n` from T type deduction, deduce only from the `x` argument.

Callers

nothing calls this directly

Calls 2

IsPowerOfTwoFunction · 0.85
CTZFunction · 0.85

Tested by

no test coverage detected