#define _HASHTABLE_POLICY_H 1
#include <tuple> // for std::tuple, std::forward_as_tuple
-#include <limits> // for std::numeric_limits
#include <bits/stl_algobase.h> // for std::min, std::is_permutation.
+#include <ext/numeric_traits.h> // for __gnu_cxx::__int_traits
namespace std _GLIBCXX_VISIBILITY(default)
{
inline std::size_t
__clp2(std::size_t __n) noexcept
{
+ using __gnu_cxx::__int_traits;
// Equivalent to return __n ? std::bit_ceil(__n) : 0;
if (__n < 2)
return __n;
? __builtin_clzll(__n - 1ull)
: __builtin_clzl(__n - 1ul);
// Doing two shifts avoids undefined behaviour when __lz == 0.
- return (size_t(1) << (numeric_limits<size_t>::digits - __lz - 1)) << 1;
+ return (size_t(1) << (__int_traits<size_t>::__digits - __lz - 1)) << 1;
}
/// Rehash policy providing power of 2 bucket numbers. Avoids modulo
// Set next resize to the max value so that we never try to rehash again
// as we already reach the biggest possible bucket number.
// Note that it might result in max_load_factor not being respected.
- _M_next_resize = numeric_limits<size_t>::max();
+ _M_next_resize = size_t(-1);
else
_M_next_resize
= __builtin_floorl(__res * (long double)_M_max_load_factor);
if (const size_t __n = std::min(_M_len, __s._M_len))
if (int __ret = traits_type::compare(_M_data, __s._M_data, __n))
return __ret;
+ using __limits = __gnu_cxx::__int_traits<int>;
const difference_type __diff = _M_len - __s._M_len;
- if (__diff > std::numeric_limits<int>::max())
- return std::numeric_limits<int>::max();
- if (__diff < std::numeric_limits<int>::min())
- return std::numeric_limits<int>::min();
+ if (__diff > __limits::__max)
+ return __limits::__max;
+ if (__diff < __limits::__min)
+ return __limits::__min;
return static_cast<int>(__diff);
}
#define _GLIBCXX_BITS_UNIFORM_INT_DIST_H
#include <type_traits>
-#include <limits>
+#include <ext/numeric_traits.h>
#if __cplusplus > 201703L
# include <concepts>
#endif
explicit
param_type(_IntType __a,
- _IntType __b = numeric_limits<_IntType>::max())
+ _IntType __b = __gnu_cxx::__int_traits<_IntType>::__max)
: _M_a(__a), _M_b(__b)
{
__glibcxx_assert(_M_a <= _M_b);
*/
explicit
uniform_int_distribution(_IntType __a,
- _IntType __b = numeric_limits<_IntType>::max())
+ _IntType __b
+ = __gnu_cxx::__int_traits<_IntType>::__max)
: _M_param(__a, __b)
{ }
#include <cstring>
#include <ext/aligned_buffer.h>
+#include <ext/numeric_traits.h>
#include <bits/std_function.h>
#include <bits/regex_constants.h>
#include <bits/regex_error.h>
static constexpr int
_S_compare(size_type __n1, size_type __n2) noexcept
{
+ using __limits = __gnu_cxx::__int_traits<int>;
const difference_type __diff = __n1 - __n2;
- if (__diff > __gnu_cxx::__int_traits<int>::__max)
- return __gnu_cxx::__int_traits<int>::__max;
- if (__diff < __gnu_cxx::__int_traits<int>::__min)
- return __gnu_cxx::__int_traits<int>::__min;
+ if (__diff > __limits::__max)
+ return __limits::__max;
+ if (__diff < __limits::__min)
+ return __limits::__min;
return static_cast<int>(__diff);
}
// Set next resize to the max value so that we never try to rehash again
// as we already reach the biggest possible bucket number.
// Note that it might result in max_load_factor not being respected.
- _M_next_resize = numeric_limits<size_t>::max();
+ _M_next_resize = size_t(-1);
else
_M_next_resize =
__builtin_floorl(*__next_bkt * (long double)_M_max_load_factor);
// { dg-do compile { target c++2a } }
#include <ranges>
+#include <limits>
void
test01()
// { dg-do run { target c++2a } }
#include <ranges>
+#include <limits>
#include <testsuite_hooks.h>
void
// { dg-do compile { target c++2a } }
#include <ranges>
+#include <limits>
constexpr bool
test01()