Integer Type Utilities

This section presents the utility types for determining the correct integer type for a given bit-width.

Base Templates

template <int Size>
struct int_for_size

A template to determine the exact int type to represent the given size.

This template provides integer types that match the given size exactly. If a given size can be represented exaclty, it provides a member type called type that is an alias for the repective integer type.

See
avr::uint_for_size For the equivalent helper for unsigned types
Since
1.0.0
Template Parameters
  • Size: The desired size of the type

template <int Size>
struct uint_for_size : public make_unsigned<int_for_size_t<Size>>

A template to determine the exact unsigned int type to represent the given size.

This template provides unsigned integer types that match the given size exactly. If a given size can be represented exaclty, it provides a member type called type that is an alias for the repective integer type.

See
avr::int_for_size For the equivalent helper for signed types
Since
1.0.0
Template Parameters
  • Size: The desired size of the type

Convenience Accessors

using int_for_size_t = typename int_for_size<Size>::type

Convenience alias for the type member of avr::int_for_size.

Since
1.0.0
Template Parameters
  • Size: The desired size of the type

using uint_for_size_t = typename uint_for_size<Size>::type

Convenience alias for the type member of avr::uint_for_size.

Since
1.0.0
Template Parameters
  • Size: The desired size of the type