MCPcopy Create free account
hub / github.com/NVIDIA/cutlass / floor_pow_2

Function floor_pow_2

include/cutlass/array.h:89–92  ·  view source on GitHub ↗

Returns the largest power of two not greater than the argument.

Source from the content-addressed store, hash-verified

87
88/// Returns the largest power of two not greater than the argument.
89CUTLASS_HOST_DEVICE
90constexpr unsigned floor_pow_2(unsigned x) {
91 return (x == 0 || ispow2(x)) ? x : ((floor_pow_2(x >> 1)) << 1);
92}
93
94////////////////////////////////////////////////////////////////////////////////////////////////////
95

Callers

nothing calls this directly

Calls 1

ispow2Function · 0.85

Tested by

no test coverage detected