10 #if !defined(SG14_LIMITS_H) 11 #define SG14_LIMITS_H 1 21 #if !defined(__clang__) && defined(__GNUG__) && (__cplusplus <= 201402L) 22 #define SG14_NUMERIC_LIMITS_128_PROVIDED 23 #elif defined(SG14_NUMERIC_LIMITS_128_PROVIDED) 24 #error SG14_NUMERIC_LIMITS_128_PROVIDED already defined 27 #if defined(SG14_INT128_ENABLED) && !defined(SG14_NUMERIC_LIMITS_128_PROVIDED) 31 struct numeric_limits<SG14_INT128> : numeric_limits<long long> {
32 static const int digits = CHAR_BIT*
sizeof(SG14_INT128)-1;
33 static const int digits10 = 38;
36 constexpr _s(uint64_t upper, uint64_t lower) : value(lower + (SG14_INT128{upper} << 64)) {}
37 constexpr
operator SG14_INT128()
const {
return value; }
41 static constexpr SG14_INT128 min()
43 return _s(0x8000000000000000, 0x0000000000000000);
46 static constexpr SG14_INT128 max()
48 return _s(0x7fffffffffffffff, 0xffffffffffffffff);
51 static constexpr SG14_INT128 lowest()
58 struct numeric_limits<SG14_UINT128> : numeric_limits<unsigned long long> {
59 static const int digits = CHAR_BIT*
sizeof(SG14_INT128);
60 static const int digits10 = 38;
63 constexpr _s(uint64_t upper, uint64_t lower) : value(lower + (SG14_UINT128{upper} << 64)) {}
64 constexpr
operator SG14_INT128()
const {
return value; }
68 static constexpr SG14_INT128 min()
73 static constexpr SG14_INT128 max()
75 return _s(0xffffffffffffffff, 0xffffffffffffffff);
78 static constexpr SG14_INT128 lowest()
85 #endif // SG14_INT128_ENABLED 87 #endif // SG14_LIMITS_H