10 #if !defined(CNL_IMPL_NUM_TRAITS_SET_DIGITS_H)
11 #define CNL_IMPL_NUM_TRAITS_SET_DIGITS_H
13 #include "../config.h"
14 #include "../cstdint/types.h"
15 #include "../numbers/signedness.h"
28 template<
class T,
int Digits>
31 template<std::
signed_
integral T,
int Digits>
33 static_assert(Digits <= digits_v<intmax_t>,
"digits exceeds widest signed integer");
36 template<std::
unsigned_
integral T,
int Digits>
38 static_assert(Digits <= digits_v<uintmax_t>,
"digits exceeds widest unsigned integer");
41 template<std::
signed_
integral T,
int Digits>
42 requires(Digits <= 7) struct set_digits<T, Digits> {
46 template<std::
unsigned_
integral T,
int Digits>
47 requires(Digits <= 8) struct set_digits<T, Digits> {
51 template<std::
signed_
integral T,
int Digits>
52 requires(Digits > 7 && Digits <= 15) struct set_digits<T, Digits> {
56 template<std::
unsigned_
integral T,
int Digits>
57 requires(Digits > 8 && Digits <= 16) struct set_digits<T, Digits> {
61 template<std::
signed_
integral T,
int Digits>
62 requires(Digits > 15 && Digits <= 31) struct set_digits<T, Digits> {
66 template<std::
unsigned_
integral T,
int Digits>
67 requires(Digits > 16 && Digits <= 32) struct set_digits<T, Digits> {
71 template<std::
signed_
integral T,
int Digits>
72 requires(Digits > 31 && Digits <= 63) struct set_digits<T, Digits> {
76 template<std::
unsigned_
integral T,
int Digits>
77 requires(Digits > 32 && Digits <= 64) struct set_digits<T, Digits> {
81 #if defined(CNL_INT128_ENABLED)
82 template<std::
signed_
integral T,
int Digits>
83 requires(Digits > 63 && Digits <= 127) struct set_digits<T, Digits> {
84 using type = int128_t;
87 template<std::
unsigned_
integral T,
int Digits>
88 requires(Digits > 64 && Digits <= 128) struct set_digits<T, Digits> {
89 using type = uint128_t;
94 template<
class T,
int Digits>
98 #endif // CNL_IMPL_NUM_TRAITS_SET_DIGITS_H