| 1009 | //! returns the nearest power of two value of num (only numerical upwards) |
| 1010 | template <typename int_type> requires(ext::is_integral_v<int_type>) |
| 1011 | constexpr int_type next_pot(const int_type num) { |
| 1012 | int_type tmp = 2; |
| 1013 | for(size_t i = 0; i < ((sizeof(int_type) * 8) - 1); ++i) { |
| 1014 | if(tmp >= num) return tmp; |
| 1015 | tmp <<= 1; |
| 1016 | } |
| 1017 | return 0; |
| 1018 | } |
| 1019 | |
| 1020 | //! computes the width of an integer value (e.g. 7 = 1, 42 = 2, 987654 = 6) |
| 1021 | template <typename int_type> requires(ext::is_integral_v<int_type>) |
no outgoing calls
no test coverage detected