| 57 | |
| 58 | template<class Integer> |
| 59 | __host__ __device__ Integer bit_floor(Integer x) { |
| 60 | static_assert(std::is_integral<Integer>::value, "bit_floor() can only be invoked with integral types"); |
| 61 | #pragma unroll |
| 62 | for (int i = 1; i < sizeof(Integer) * 8; i *= 2) |
| 63 | x |= x >> i; |
| 64 | return (x + 1) >> 1; |
| 65 | } |
| 66 | |
| 67 | template<class Integer> |
| 68 | __host__ __device__ Integer bit_ceil(Integer x) { |
nothing calls this directly
no outgoing calls
no test coverage detected