| 25 | namespace ruy { |
| 26 | |
| 27 | inline int floor_log2(int n) { |
| 28 | RUY_DCHECK_GE(n, 1); |
| 29 | #ifdef _WIN32 |
| 30 | unsigned long result; // NOLINT[runtime/int] |
| 31 | _BitScanReverse(&result, n); |
| 32 | return result; |
| 33 | #else |
| 34 | return 31 - __builtin_clz(n); |
| 35 | #endif |
| 36 | } |
| 37 | |
| 38 | inline int ceil_log2(int n) { |
| 39 | RUY_DCHECK_GE(n, 1); |
no outgoing calls
no test coverage detected