Skip to content

Struct hal::bit_limits

template <size_t BitWidth, std::integral int_t>

ClassList > hal > bit_limits

Similar to std::numeric_limits<T> except that this object can give properties of integral types of arbitrary bit widths. More...

  • #include <bit_limits.hpp>

Public Static Functions

Type Name
constexpr int_t max ()
Get the maximum value available for an integer of BitWidth size and that can be stored withinint_t .
constexpr int_t min ()
Get the minimum value available for an integer of BitWidth size and that can be stored withinint_t .

Detailed Description

Template parameters:

  • BitWidth - bit width of the value
  • int_t - the containing type. Will generate a compile error if the containing type's bit width is smaller than the BitWidth value.

Public Static Functions Documentation

function max

Get the maximum value available for an integer of BitWidth size and that can be stored withinint_t .

static inline constexpr int_t hal::bit_limits::max () 

The final value of the function depends also on the sign of the int type.

Returns:

constexpr int_t maximum value

function min

Get the minimum value available for an integer of BitWidth size and that can be stored withinint_t .

static inline constexpr int_t hal::bit_limits::min () 

The final value of the function depends also on the sign of the int type. Unsigned ints simply return zero.

Returns:

constexpr int_t minimum value


The documentation for this class was generated from the following file libraries/include/libhal-util/bit_limits.hpp