| 289 | |
| 290 | template <size_t kBits, typename T> |
| 291 | constexpr bool IsAbsoluteUint(T value) { |
| 292 | static_assert(kBits <= BitSizeOf<T>(), "kBits must be <= max."); |
| 293 | static_assert(std::is_integral<T>::value, "Needs an integral type."); |
| 294 | using unsigned_type = typename std::make_unsigned<T>::type; |
| 295 | return (kBits == BitSizeOf<T>()) |
| 296 | ? true |
| 297 | : IsUint<kBits>(value < 0 |
| 298 | ? static_cast<unsigned_type>(-1 - value) + 1u // Avoid overflow. |
| 299 | : static_cast<unsigned_type>(value)); |
| 300 | } |
| 301 | |
| 302 | // Generate maximum/minimum values for signed/unsigned n-bit integers |
| 303 | template <typename T> |
nothing calls this directly
no outgoing calls
no test coverage detected