5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_MANIPULATION_SMALLEST_INTEGER_FOR_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_MANIPULATION_SMALLEST_INTEGER_FOR_HPP_
10#include "arene/base/stdlib_choice/climits.hpp"
11#include "arene/base/stdlib_choice/cstdint.hpp"
12#include "arene/base/stdlib_choice/enable_if.hpp"
13#include "arene/base/stdlib_choice/numeric_limits.hpp"
22namespace smallest_integer_for_detail {
37template <std::u
int64_t MaxValue>
39 (MaxValue <= smallest_integer_for_detail::max_uint8),
42 (MaxValue <= smallest_integer_for_detail::max_uint16),
44 conditional_t<(MaxValue <= smallest_integer_for_detail::max_uint32), std::uint32_t, std::uint64_t>>>;
55template <std::
int64_t MinValue, std::
int64_t MaxValue, constra
ints<std::enable_if_t<(MaxValue >= MinValue)>> =
nullptr>
57 (MaxValue <= smallest_integer_for_detail::max_int8) && (MinValue >= smallest_integer_for_detail::min_int8),
60 (MaxValue <= smallest_integer_for_detail::max_int16) && (MinValue >= smallest_integer_for_detail::min_int16),
63 (MaxValue <= smallest_integer_for_detail::max_int32) &&
64 (MinValue >= smallest_integer_for_detail::min_int32),
static constexpr auto min() noexcept -> T
The minimum finite value; the minimum positive normalized value for floating point types.
Definition numeric_limits.hpp:235
static constexpr auto max() noexcept -> T
The maximum finite value.
Definition numeric_limits.hpp:230
Definition accumulate.hpp:37
typename static_if< B >::template then_else< T, F > conditional_t
lazily select between two types based on a boolean condition
Definition conditional.hpp:28
conditional_t<(MaxValue<=smallest_integer_for_detail::max_int8) &&(MinValue >=smallest_integer_for_detail::min_int8), std::int8_t, conditional_t<(MaxValue<=smallest_integer_for_detail::max_int16) &&(MinValue >=smallest_integer_for_detail::min_int16), std::int16_t, conditional_t<(MaxValue<=smallest_integer_for_detail::max_int32) &&(MinValue >=smallest_integer_for_detail::min_int32), std::int32_t, std::int64_t > > > smallest_signed_integer_for
Calculates the smallest unsigned integer type that can be used to hold values from MinValue up to and...
Definition smallest_integer_for.hpp:56
conditional_t<(MaxValue<=smallest_integer_for_detail::max_uint8), std::uint8_t, conditional_t<(MaxValue<=smallest_integer_for_detail::max_uint16), std::uint16_t, conditional_t<(MaxValue<=smallest_integer_for_detail::max_uint32), std::uint32_t, std::uint64_t > > > smallest_unsigned_integer_for
Calculates the smallest unsigned integer type that can be used to hold values up to and including Max...
Definition smallest_integer_for.hpp:38
smallest_unsigned_integer_for< 1ULL<<(sizeof(T) *CHAR_BIT - 1)> smallest_unsigned_integer_for_type
Calculates the smallest unsigned integer type that can be used to hold values of type T.
Definition smallest_integer_for.hpp:49
Definition accumulate.hpp:36
::int32_t int32_t
A 32-bit signed integer type.
Definition cstdint.hpp:66
::int16_t int16_t
A 16-bit signed integer type.
Definition cstdint.hpp:61
::uint8_t uint8_t
An 8-bit unsigned integer type.
Definition cstdint.hpp:30
::uint16_t uint16_t
A 16-bit unsigned integer type.
Definition cstdint.hpp:36
::uint64_t uint64_t
A 64-bit unsigned integer type.
Definition cstdint.hpp:47
::int8_t int8_t
An 8-bit signed integer type.
Definition cstdint.hpp:55
::int64_t int64_t
A 64-bit signed integer type.
Definition cstdint.hpp:71