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