M5Utility 0.0.8 git rev:f3e2efe
Loading...
Searching...
No Matches
m5::utility::uint_least_for_bits< N > Class Template Reference

Gets the smallest unsigned integer type that can store N bit. More...

#include <misc.hpp>

Public Types

using type
 

Detailed Description

template<uint32_t N>
class m5::utility::uint_least_for_bits< N >

Gets the smallest unsigned integer type that can store N bit.

Template Parameters
NNumber of bits
Note
using foo_t = uint_least_for_bits<52>::type; // foo_t == uint64_t

Member Typedef Documentation

◆ type

template<uint32_t N>
using m5::utility::uint_least_for_bits< N >::type
Initial value:
typename std::conditional<
(N <= 8), uint8_t,
typename std::conditional<
(N <= 16), uint16_t,
typename std::conditional<
(N <= 32), uint32_t,
uint64_t
>::type
>::type
>::type