[PATCH] libstdc++, v2: Partially implement library part of P3666R5 - Bit-precise integers
Jakub Jelinek
jakub@redhat.com
Fri Nov 13 12:50:31 GMT 2026
Hi!
Here is an updated version of the library parts of
P3666R5 - Bit-precise integers
paper.
This is on top of the
https://gcc.gnu.org/pipermail/gcc-patches/2026-November/738467.html
https://gcc.gnu.org/pipermail/gcc-patches/2026-November/738732.html
patches, and compared to the previously posted patch it has
std::to_chars/std::from_chars bit-precise integer support added
(if we didn't care about performance, maybe just adding the
__to_chars_unsigned_type changes and adding std::to_chars template
with enable_if_t on __is_bitint could be enough, but I think it is
worth it to optimize a little, so that we don't multiply + add
or shift + or or divide + modulo + cast or shift + and + cast
for every single digit, consider say _BitInt(4096), each of those
operations affects usually 64 or 128 limbs, so what I'm trying in
the patch is to use an unsigned long long temporary into which
or from which we can accumulate some processing and thus reduce the
number of times we operate on the full _BitInt e.g. 19x times for base 10,
etc. I've left the non-2/8/10/16 base to_chars unoptimized, I think that
one is rarely used in practice), __is_bitint trait which is used in a couple
of places, improved the __make_unsigned_selector* stuff, added std::abs
(note, as discussed privately, it doesn't exactly match the current
paper wording, because std::abs<_BitInt(67)>(0) or std::abs<__int128>(-1)
will not work).
I haven't went through all the headers which e.g. say that bitint shouldn't
be supported there, verifying that it isn't.
One thing to think about is that e.g. <bit> uses
#if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_popcountg)
etc., but doesn't really have a fallback for bit-precise values.
Are we ok with -D_GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS not supporting _BitInt
properly, or shall we change in those cases to
#if __has_builtin(__builtin_popcountg), or add proper fallback?
2026-11-13 Jakub Jelinek <jakub@redhat.com>
* include/bits/version.def (bit_int): New FTM.
* include/bits/version.h: Regenerate.
* include/bits/functional_hash.h (std::hash): Add _BitInt(N) and
unsigned _BitInt(N) partial specializations.
* include/bits/cpp_type_traits.h (std::__is_integer): Likewise.
* include/bits/std_abs.h (std::abs): Handle signed _BitInt.
* include/c_global/climits (BITINT_MAXWIDTH): Define if
__BITINT_MAXWIDTH__ is defined.
* include/ext/numeric_traits.h (__gnu_cxx::__is_integer_nonstrict):
Add _BitInt(N) and unsigned _BitInt(N) partial specializations.
(__gnu_cxx::__numeric_traits_integer): Add _BitInt(1) specialization.
* include/std/limits (std::numeric_limits): Add _BitInt(N) and
unsigned _BitInt(N) partial specializations.
* include/std/type_traits (std::__is_bitint): New trait.
(std::__is_integral_helper): Add _BitInt(N) and unsigned _BitInt(N)
partial specializations.
(std::__underlying_type_impl): Move definition earlier.
(std::__make_unsigned, std::__make_signed): Add _BitInt(N) and
unsigned _BitInt(N) partial specializations.
(std::__make_unsigned_selector_base): Change into template.
Add _BitInt(N) and unsigned _BitInt(N) partial specializations for
it.
(std::__make_unsigned_selector): Depend on
__make_unsigned_selector_base instantiation with underlying type
instead of just __make_unsigned_selector_base, adjust for dependent
base.
* include/std/bit (std::byteswap): Use __builtin_popcountg if
possible. Guard fallback on if constexpr (sizeof(_Tp) > 1).
(std::bit_compress, std::bit_expand): Guard most of the algorithm
with if constexpr (_Nd > 1).
* include/std/charconv
(std::__detail::__to_chars_unsigned_type_bitint): New function
template.
(std::__detail::__to_chars_unsigned_type): Use it for bit-precise
integer types.
(std::__detail::__to_chars_16, __to_chars_10, __to_chars_8,
__to_chars_2): Add overloads for bit-precise integer types.
(std::to_chars): Add template for bit-precise integer types.
(std::__detail::__from_chars_pow2_base,
std::__detail::__from_chars_alnum): Add optimized handling for large
bit-precise integer types.
* testsuite/18_support/headers/climits/bitint.cc: New test.
* testsuite/18_support/numeric_limits/bitint.cc: New test.
* testsuite/20_util/hash/bitint.cc: New test.
* testsuite/20_util/integer_sequence/bitint.cc: New test.
* testsuite/20_util/is_arithmetic/bitint.cc: New test.
* testsuite/20_util/is_integral/bitint.cc: New test.
* testsuite/20_util/make_signed/bitint.cc: New test.
* testsuite/20_util/make_unsigned/bitint.cc: New test.
* testsuite/20_util/from_chars/bitint.cc: New test.
* testsuite/20_util/to_chars/bitint.cc: New test.
* testsuite/26_numerics/bit/bit.byteswap/bitint.cc: New test.
* testsuite/26_numerics/bit/bit.count/countl_one.cc: Add _BitInt
tests. Guard tests which require 2+ or 8+ bit precision.
* testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotr.cc: Likewise.
* testsuite/26_numerics/bit/bit.shift/shl.cc: Likewise.
* testsuite/26_numerics/bit/bit.shift/shr.cc: Likewise.
* testsuite/26_numerics/bit/bit.permute/bit_compress.cc: Likewise.
* testsuite/26_numerics/bit/bit.permute/bit_expand.cc: Likewise.
* testsuite/26_numerics/bit/bit.permute/bit_repeat.cc: Likewise.
* testsuite/26_numerics/bit/bit.permute/bit_reverse.cc: Likewise.
* testsuite/26_numerics/headers/cmath/bitint.cc: New test.
* testsuite/26_numerics/headers/cstdlib/bitint.cc: New test.
* testsuite/std/concepts/concepts.lang/concept.arithmetic/bitint.cc:
New test.
--- a/libstdc++-v3/include/bits/version.def 2026-11-09 21:25:07.009711684 +0100
+++ b/libstdc++-v3/include/bits/version.def 2026-11-11 21:39:13.018479588 +0100
@@ -2717,6 +2717,14 @@ ftms = {
};
};
+ftms = {
+ name = bit_int;
+ values = {
+ v = 202611;
+ extra_cond = "defined(__cpp_bit_int)";
+ };
+};
+
// Standard test specifications.
stds[97] = ">= 199711L";
stds[03] = ">= 199711L";
--- a/libstdc++-v3/include/bits/version.h 2026-11-09 21:25:07.009711684 +0100
+++ b/libstdc++-v3/include/bits/version.h 2026-11-11 21:39:13.020032902 +0100
@@ -3001,4 +3001,14 @@
#endif /* !defined(__cpp_lib_clmul) */
#undef __glibcxx_want_clmul
+#if !defined(__cpp_lib_bit_int)
+# if (defined(__cpp_bit_int))
+# define __glibcxx_bit_int 202611L
+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bit_int)
+# define __cpp_lib_bit_int 202611L
+# endif
+# endif
+#endif /* !defined(__cpp_lib_bit_int) */
+#undef __glibcxx_want_bit_int
+
#undef __glibcxx_want_all
--- a/libstdc++-v3/include/bits/functional_hash.h 2026-01-02 22:41:17.626547803 +0100
+++ b/libstdc++-v3/include/bits/functional_hash.h 2026-11-11 22:14:12.539599684 +0100
@@ -208,6 +208,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Cxx_hashtable_define_trivial_hash(__int128 unsigned)
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ struct hash<_BitInt(_Np)> : public __hash_base<size_t, _BitInt(_Np)>
+ {
+ size_t
+ operator()(_BitInt(_Np) __val) const noexcept
+ { return static_cast<size_t>(__val); }
+ };
+ __extension__
+ template<size_t _Np>
+ struct hash<unsigned _BitInt(_Np)>
+ : public __hash_base<size_t, unsigned _BitInt(_Np)>
+ {
+ size_t
+ operator()(unsigned _BitInt(_Np) __val) const noexcept
+ { return static_cast<size_t>(__val); }
+ };
+#endif
+
#undef _Cxx_hashtable_define_trivial_hash
struct _Hash_impl
--- a/libstdc++-v3/include/bits/cpp_type_traits.h 2026-01-02 22:41:17.625547820 +0100
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h 2026-11-11 21:39:13.020446223 +0100
@@ -273,6 +273,23 @@ __INT_N(__GLIBCXX_TYPE_INT_N_2)
__INT_N(__GLIBCXX_TYPE_INT_N_3)
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ struct __is_integer<_BitInt(_Np)>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+ __extension__
+ template<size_t _Np>
+ struct __is_integer<unsigned _BitInt(_Np)>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
// In strict modes __GLIBCXX_TYPE_INT_N_0 is not defined for __int128,
// but we want to always treat signed/unsigned __int128 as integral types.
--- a/libstdc++-v3/include/bits/std_abs.h 2026-01-02 22:41:17.632547704 +0100
+++ b/libstdc++-v3/include/bits/std_abs.h 2026-11-13 12:49:25.897378564 +0100
@@ -110,6 +110,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ inline _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ abs(_BitInt(_Np) __x) { return __x >= 0 ? __x : -__x; }
+#endif
+
#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
constexpr _Float16
abs(_Float16 __x)
--- a/libstdc++-v3/include/c_global/climits 2026-01-02 22:41:17.641547555 +0100
+++ b/libstdc++-v3/include/c_global/climits 2026-11-11 21:39:13.020570351 +0100
@@ -61,6 +61,11 @@
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif
+#ifdef __BITINT_MAXWIDTH__
+# undef BITINT_MAXWIDTH
+# define BITINT_MAXWIDTH __BITINT_MAXWIDTH__
+#endif
+
#pragma GCC diagnostic pop
#endif
--- a/libstdc++-v3/include/ext/numeric_traits.h 2026-01-02 22:41:17.650547405 +0100
+++ b/libstdc++-v3/include/ext/numeric_traits.h 2026-11-11 21:39:13.020667347 +0100
@@ -126,6 +126,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3)
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<std::size_t _Np>
+ struct __is_integer_nonstrict<_BitInt(_Np)>
+ {
+ enum { __value = 1 };
+ typedef std::__true_type __type;
+ enum { __width = _Np };
+ };
+ __extension__
+ template<std::size_t _Np>
+ struct __is_integer_nonstrict<unsigned _BitInt(_Np)>
+ {
+ enum { __value = 1 };
+ typedef std::__true_type __type;
+ enum { __width = _Np };
+ };
+ __extension__
+ template<>
+ struct __numeric_traits_integer<_BitInt(1)>
+ {
+ static const bool __is_signed = true;
+ static const int __digits = 0;
+ static const _BitInt(1) __max = _BitInt(1)();
+ static const _BitInt(1) __min = _BitInt(1)(-1);
+ };
+#endif
+
#undef _GLIBCXX_INT_N_TRAITS
#if __cplusplus >= 201103L
--- a/libstdc++-v3/include/std/limits 2026-05-21 23:02:29.021148119 +0200
+++ b/libstdc++-v3/include/std/limits 2026-11-11 22:13:49.343907582 +0100
@@ -1711,6 +1711,164 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#undef __INT_N_201103
#undef __INT_N_U201103
+#ifdef __BITINT_MAXWIDTH__
+ /// numeric_limits<_BitInt(N)> partial specialization.
+ __extension__
+ template<size_t _Np>
+ struct numeric_limits<_BitInt(_Np)>
+ {
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ min() _GLIBCXX_USE_NOEXCEPT
+ {
+ return _Np == 1 ? _BitInt(_Np)(-1)
+ : __glibcxx_min_b (_BitInt(_Np), _Np);
+ }
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ max() _GLIBCXX_USE_NOEXCEPT
+ {
+ return _Np == 1 ? _BitInt(_Np)(0)
+ : __glibcxx_max_b (_BitInt(_Np), _Np);
+ }
+
+#if __cplusplus >= 201103L
+ static constexpr _BitInt(_Np)
+ lowest() noexcept { return min(); }
+#endif
+
+ static _GLIBCXX_USE_CONSTEXPR int digits = _Np - 1;
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = int(((_Np - 1) * 1936274LL) / 6432163);
+#if __cplusplus >= 201103L
+ static constexpr int max_digits10 = 0;
+#endif
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ _GLIBCXX23_DEPRECATED
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ _GLIBCXX23_DEPRECATED
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ infinity() _GLIBCXX_USE_NOEXCEPT { return _BitInt(_Np)(); }
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _BitInt(_Np)(); }
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _BitInt(_Np)(); }
+
+ static _GLIBCXX_CONSTEXPR _BitInt(_Np)
+ denorm_min() _GLIBCXX_USE_NOEXCEPT { return _BitInt(_Np)(); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
+ };
+
+ /// numeric_limits<unsigned _BitInt(N)> partial specialization.
+ __extension__
+ template<size_t _Np>
+ struct numeric_limits<unsigned _BitInt(_Np)>
+ {
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ min() _GLIBCXX_USE_NOEXCEPT { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ max() _GLIBCXX_USE_NOEXCEPT
+ {
+ return __glibcxx_max_b (unsigned _BitInt(_Np), _Np);
+ }
+
+#if __cplusplus >= 201103L
+ static constexpr unsigned _BitInt(_Np)
+ lowest() noexcept { return min(); }
+#endif
+
+ static _GLIBCXX_USE_CONSTEXPR int digits = _Np;
+ static _GLIBCXX_USE_CONSTEXPR int digits10
+ = int((_Np * 1936274LL) / 6432163);
+#if __cplusplus >= 201103L
+ static constexpr int max_digits10 = 0;
+#endif
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
+
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+ _GLIBCXX23_DEPRECATED
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+ = denorm_absent;
+ _GLIBCXX23_DEPRECATED
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ infinity() _GLIBCXX_USE_NOEXCEPT
+ { return static_cast<unsigned _BitInt(_Np)>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ quiet_NaN() _GLIBCXX_USE_NOEXCEPT
+ { return static_cast<unsigned _BitInt(_Np)>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ signaling_NaN() _GLIBCXX_USE_NOEXCEPT
+ { return static_cast<unsigned _BitInt(_Np)>(0); }
+
+ static _GLIBCXX_CONSTEXPR unsigned _BitInt(_Np)
+ denorm_min() _GLIBCXX_USE_NOEXCEPT
+ { return static_cast<unsigned _BitInt(_Np)>(0); }
+
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
+ = round_toward_zero;
+ };
+#endif
/// numeric_limits<float> specialization.
template<>
--- a/libstdc++-v3/include/std/type_traits 2026-11-11 21:38:55.132212991 +0100
+++ b/libstdc++-v3/include/std/type_traits 2026-11-12 12:12:53.933818272 +0100
@@ -538,6 +538,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ struct __is_integral_helper<_BitInt(_Np)>
+ : public true_type
+ { static constexpr auto _S_kind = _Integer_kind::_Signed; };
+
+ __extension__
+ template<size_t _Np>
+ struct __is_integral_helper<unsigned _BitInt(_Np)>
+ : public true_type
+ { static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
+#endif
+
// Check if a type is one of the signed integer types.
template<typename _Tp>
using __is_signed_integer
@@ -566,6 +580,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
/// @cond undocumented
+#ifdef __BITINT_MAXWIDTH__
+ template<typename _Tp>
+ struct __is_bitint
+ : public false_type { };
+
+ __extension__
+ template<size_t _Np>
+ struct __is_bitint<_BitInt(_Np)>
+ : public true_type { };
+
+ __extension__
+ template<size_t _Np>
+ struct __is_bitint<unsigned _BitInt(_Np)>
+ : public true_type { };
+#endif
+
template<typename>
struct __is_floating_point_helper
: public false_type { };
@@ -1959,6 +1989,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __type = typename __match::__type;
};
+ template<typename _Tp, bool = __is_enum(_Tp)>
+ struct __underlying_type_impl
+ {
+ using type = __underlying_type(_Tp);
+ };
+
+ template<typename _Tp>
+ struct __underlying_type_impl<_Tp, false>
+ { };
+
// Utility for finding the unsigned versions of signed integral types.
#if !(_GLIBCXX_USE_BUILTIN_TRAIT(__make_unsigned) \
&& _GLIBCXX_USE_BUILTIN_TRAIT(__make_signed))
@@ -2020,6 +2060,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __make_unsigned<__int128>
{ using __type = unsigned __int128; };
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ struct __make_unsigned<_BitInt(_Np)>
+ { using __type = unsigned _BitInt(_Np); };
+#endif
// Select between integral and enum: not possible to be both.
template<typename _Tp,
@@ -2038,6 +2084,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
};
+ template<typename _Vp>
class __make_unsigned_selector_base
{
protected:
@@ -2060,21 +2107,55 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
};
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ class __make_unsigned_selector_base<_BitInt(_Np)>
+ {
+ protected:
+ template<typename...> struct _List { };
+ template<size_t _Sz, typename... _UInts>
+ struct __select
+ { using __type = unsigned _BitInt(_Np); };
+ };
+
+ __extension__
+ template<size_t _Np>
+ class __make_unsigned_selector_base<unsigned _BitInt(_Np)>
+ {
+ protected:
+ template<typename...> struct _List { };
+ template<size_t _Sz, typename... _UInts>
+ struct __select
+ { using __type = unsigned _BitInt(_Np); };
+ };
+#endif
+
// Choose unsigned integer type with the smallest rank and same size as _Tp
template<typename _Tp>
class __make_unsigned_selector<_Tp, false, true>
- : __make_unsigned_selector_base
+ : __make_unsigned_selector_base<typename
+ __conditional_t<__is_enum(_Tp),
+ __underlying_type_impl<_Tp>,
+ __type_identity<_Tp>>::type>
{
// With -fshort-enums, an enum may be as small as a char.
+ using _Base_arg
+ = typename __conditional_t<__is_enum(_Tp), __underlying_type_impl<_Tp>,
+ __type_identity<_Tp>>::type;
+ using _Base
+ = __make_unsigned_selector_base<_Base_arg>;
__extension__
- using _UInts = _List<unsigned char, unsigned short, unsigned int,
- unsigned long, unsigned long long
+ using _UInts
+ = typename _Base::_List<unsigned char, unsigned short, unsigned int,
+ unsigned long, unsigned long long
#ifdef __SIZEOF_INT128__
- , unsigned __int128
+ , unsigned __int128
#endif
- >;
+ >;
- using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
+ using __unsigned_type
+ = typename _Base::__select<sizeof(_Tp), _UInts>::__type;
public:
using __type
@@ -2200,6 +2281,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __make_signed<unsigned __int128>
{ using __type = __int128; };
#endif
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ struct __make_signed<unsigned _BitInt(_Np)>
+ { using __type = _BitInt(_Np); };
+#endif
// Select between integral and enum: not possible to be both.
template<typename _Tp,
@@ -2730,15 +2817,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __common_type_fold<_CTp, _Rp, void>
{ };
- template<typename _Tp, bool = __is_enum(_Tp)>
- struct __underlying_type_impl
- {
- using type = __underlying_type(_Tp);
- };
-
- template<typename _Tp>
- struct __underlying_type_impl<_Tp, false>
- { };
/// @endcond
/// The underlying type of an enum.
--- a/libstdc++-v3/include/std/bit 2026-11-11 21:38:55.133243375 +0100
+++ b/libstdc++-v3/include/std/bit 2026-11-11 21:39:13.021567348 +0100
@@ -129,26 +129,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return (__builtin_bswap64(__value >> 64)
| (static_cast<_Tp>(__builtin_bswap64(__value)) << 64));
#endif
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_bswapg)
+ constexpr auto _Nd
+ = __gnu_cxx::__int_traits<__remove_cv_t<_Tp>>::__digits;
+ if constexpr (_Nd % __CHAR_BIT__ == 0)
+ {
+ using _Up = typename make_unsigned<__remove_cv_t<_Tp>>::type;
+ return __builtin_bswapg(_Up(__value));
+ }
+#endif
}
#endif
- // Fallback implementation that handles even __int24 etc.
- using _Up = typename make_unsigned<__remove_cv_t<_Tp>>::type;
- size_t __diff = __CHAR_BIT__ * (sizeof(_Tp) - 1);
- _Up __mask1 = static_cast<unsigned char>(~0);
- _Up __mask2 = __mask1 << __diff;
- _Up __val = __value;
- for (size_t __i = 0; __i < sizeof(_Tp) / 2; ++__i)
- {
- _Up __byte1 = __val & __mask1;
- _Up __byte2 = __val & __mask2;
- __val = (__val ^ __byte1 ^ __byte2
- ^ (__byte1 << __diff) ^ (__byte2 >> __diff));
- __mask1 <<= __CHAR_BIT__;
- __mask2 >>= __CHAR_BIT__;
- __diff -= 2 * __CHAR_BIT__;
+ if constexpr (sizeof(_Tp) > 1)
+ {
+ // Fallback implementation that handles even __int24 etc.
+ using _Up = typename make_unsigned<__remove_cv_t<_Tp>>::type;
+ size_t __diff = __CHAR_BIT__ * (sizeof(_Tp) - 1);
+ _Up __mask1 = static_cast<unsigned char>(~0);
+ _Up __mask2 = __mask1 << __diff;
+ _Up __val = __value;
+ for (size_t __i = 0; __i < sizeof(_Tp) / 2; ++__i)
+ {
+ _Up __byte1 = __val & __mask1;
+ _Up __byte2 = __val & __mask2;
+ __val = (__val ^ __byte1 ^ __byte2
+ ^ (__byte1 << __diff) ^ (__byte2 >> __diff));
+ __mask1 <<= __CHAR_BIT__;
+ __mask2 >>= __CHAR_BIT__;
+ __diff -= 2 * __CHAR_BIT__;
+ }
+ return __val;
}
- return __val;
+ return __value;
}
#endif // __cpp_lib_byteswap
@@ -578,17 +591,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr auto _Nd = __gnu_cxx::__int_traits<_Tp>::__digits;
// Based on "Compress, or Generalized Extract" in Hacker's Delight
__x &= __m;
- _Tp __mk = ~__m << 1;
- for (int __i = 1; __i < _Nd; __i <<= 1)
+ if constexpr (_Nd > 1)
{
- _Tp __mp = __mk;
- for (int __j = 1; __j < _Nd; __j <<= 1)
- __mp ^= __mp << __j;
- _Tp __mv = __mp & __m;
- __m = (__m ^ __mv) | (__mv >> __i);
- _Tp __t = __x & __mv;
- __x = (__x ^ __t) | (__t >> __i);
- __mk = __mk & ~__mp;
+ _Tp __mk = ~__m << 1;
+ for (int __i = 1; __i < _Nd; __i <<= 1)
+ {
+ _Tp __mp = __mk;
+ for (int __j = 1; __j < _Nd; __j <<= 1)
+ __mp ^= __mp << __j;
+ _Tp __mv = __mp & __m;
+ __m = (__m ^ __mv) | (__mv >> __i);
+ _Tp __t = __x & __mv;
+ __x = (__x ^ __t) | (__t >> __i);
+ __mk = __mk & ~__mp;
+ }
}
return __x;
#endif
@@ -604,30 +620,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr auto _Nd = __gnu_cxx::__int_traits<_Tp>::__digits;
if constexpr (_Nd == 1)
return __x & __m;
- constexpr auto __log2_Nd
- = _Nd == 1 ? 1 : (__gnu_cxx::__int_traits<unsigned>::__digits
- - std::__countl_zero<unsigned>(_Nd - 1));
- // Based on "Expand, or Generalized Insert" in Hacker's Delight
- _Tp __m0 = __m;
- _Tp __mk = ~__m << 1;
- _Tp __array[__log2_Nd];
- for (int __i = 0; __i < __log2_Nd; __i++)
- {
- _Tp __mp = __mk;
- for (int __j = 1; __j < _Nd; __j <<= 1)
- __mp ^= __mp << __j;
- _Tp __mv = __mp & __m;
- __array[__i] = __mv;
- __m = (__m ^ __mv) | (__mv >> (_Tp(1) << __i));
- __mk = __mk & ~__mp;
- }
- for (int __i = __log2_Nd - 1; __i >= 0; __i--)
- {
- _Tp __mv = __array[__i];
- _Tp __t = __x << (_Tp(1) << __i);
- __x = (__x & ~__mv) | (__t & __mv);
+ else
+ {
+ constexpr auto __log2_Nd
+ = _Nd == 1 ? 1 : (__gnu_cxx::__int_traits<unsigned>::__digits
+ - std::__countl_zero<unsigned>(_Nd - 1));
+ // Based on "Expand, or Generalized Insert" in Hacker's Delight
+ _Tp __m0 = __m;
+ _Tp __mk = ~__m << 1;
+ _Tp __array[__log2_Nd];
+ for (int __i = 0; __i < __log2_Nd; __i++)
+ {
+ _Tp __mp = __mk;
+ for (int __j = 1; __j < _Nd; __j <<= 1)
+ __mp ^= __mp << __j;
+ _Tp __mv = __mp & __m;
+ __array[__i] = __mv;
+ __m = (__m ^ __mv) | (__mv >> (_Tp(1) << __i));
+ __mk = __mk & ~__mp;
+ }
+ for (int __i = __log2_Nd - 1; __i >= 0; __i--)
+ {
+ _Tp __mv = __array[__i];
+ _Tp __t = __x << (_Tp(1) << __i);
+ __x = (__x & ~__mv) | (__t & __mv);
+ }
+ return __x & __m0;
}
- return __x & __m0;
#endif
}
#endif // __cpp_lib_bitops >= 202607L
--- a/libstdc++-v3/include/std/charconv 2026-11-10 21:13:19.638803618 +0100
+++ b/libstdc++-v3/include/std/charconv 2026-11-13 08:57:37.730634106 +0100
@@ -91,6 +91,47 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ constexpr auto
+ __to_chars_unsigned_type_bitint(unsigned _BitInt(_Np))
+ {
+ if constexpr (_Np <= __gnu_cxx::__int_traits<unsigned int>::__digits)
+ return __type_identity<unsigned int>{};
+ else if constexpr (_Np
+ <= __gnu_cxx::__int_traits<unsigned long>::__digits)
+ return __type_identity<unsigned long>{};
+ else if constexpr (_Np
+ <= __gnu_cxx::__int_traits<unsigned
+ long long>::__digits)
+ return __type_identity<unsigned long>{};
+#if __SIZEOF_INT128__ > __SIZEOF_LONG_LONG__
+ else if constexpr (_Np
+ <= __gnu_cxx::__int_traits<unsigned
+ __int128>::__digits)
+ return __type_identity<unsigned __int128>{};
+#endif
+ else
+ {
+ // Round up width to next multiple of long long precision if possible
+ // to decrease number of needed instantiations.
+ constexpr auto _Nd
+ = __gnu_cxx::__int_traits<unsigned long long>::__digits;
+ constexpr auto __prec = (_Np + _Nd - 1) - ((_Np + _Nd - 1) % _Nd);
+ constexpr auto __n = (__prec > __BITINT_MAXWIDTH__
+ ? __BITINT_MAXWIDTH__ : __prec);
+ return __type_identity<unsigned _BitInt(__n)>{};
+ }
+ }
+
+ __extension__
+ template<size_t _Np>
+ constexpr auto
+ __to_chars_unsigned_type_bitint(_BitInt(_Np))
+ { return __to_chars_unsigned_type_bitint((unsigned _BitInt(_Np))0); }
+#endif
+
// Pick an unsigned type of suitable size. This is used to reduce the
// number of specializations of __to_chars_len, __to_chars etc. that
// get instantiated. For example, to_chars<char> and to_chars<short>
@@ -100,6 +141,11 @@ namespace __detail
constexpr auto
__to_chars_unsigned_type()
{
+#ifdef __BITINT_MAXWIDTH__
+ if constexpr (__is_bitint<_Tp>::value)
+ return __to_chars_unsigned_type_bitint(_Tp());
+ else
+#endif
if constexpr (sizeof(_Tp) <= sizeof(unsigned int))
return __type_identity<unsigned int>{};
else if constexpr (sizeof(_Tp) <= sizeof(unsigned long))
@@ -214,6 +260,64 @@ namespace __detail
return __res;
}
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ constexpr to_chars_result
+ __to_chars_16(char* __first, char* __last,
+ unsigned _BitInt(_Np) __val) noexcept
+ {
+ using _Tp = unsigned _BitInt(_Np);
+ static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation bug");
+ static_assert(__gnu_cxx::__int_traits<unsigned long long>::__digits
+ >= 64);
+
+ to_chars_result __res;
+
+ const unsigned __len = (__to_chars_len_2(__val) + 3) / 4;
+
+ if (__builtin_expect(size_t(__last - __first) < __len, 0))
+ {
+ __res.ptr = __last;
+ __res.ec = errc::value_too_large;
+ return __res;
+ }
+
+ constexpr char __digits[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+ unsigned __pos = __len - 1;
+ // For bit-precise integers, try to avoid too many
+ // operations on the whole _BitInt.
+ while (__pos + 1 >= 16)
+ {
+ unsigned long long __num = __val;
+ __val >>= 64;
+ for (unsigned __i = 0; __i < 16; ++__i)
+ {
+ __first[__pos - __i] = __digits[__num & 0xF];
+ __num >>= 4;
+ }
+ __pos -= 16;
+ }
+ if (__pos != -1U)
+ {
+ unsigned long long __num = __val;
+ do
+ {
+ __first[__pos] = __digits[__num & 0xF];
+ __num >>= 4;
+ --__pos;
+ }
+ while (__pos != -1U);
+ }
+ __res.ptr = __first + __len;
+ __res.ec = {};
+ return __res;
+ }
+#endif
+
template<typename _Tp>
constexpr to_chars_result
__to_chars_10(char* __first, char* __last, _Tp __val) noexcept
@@ -237,6 +341,74 @@ namespace __detail
return __res;
}
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ constexpr to_chars_result
+ __to_chars_10(char* __first, char* __last,
+ unsigned _BitInt(_Np) __val) noexcept
+ {
+ using _Tp = unsigned _BitInt(_Np);
+ static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation bug");
+ static_assert(__gnu_cxx::__int_traits<unsigned long long>::__digits
+ >= 64);
+
+ to_chars_result __res;
+ const unsigned __width = __to_chars_len_2(__val);
+ // Actual __len could be __min_len or __min_len + 1. In order to avoid
+ // too many operations on possibly huge _BitInt, optimistically assume
+ // __len is equal to __min_len and if not, move all chars by one position
+ // and insert the most significant digit at the beginning.
+ const unsigned __min_len = ((__width - 1) * 1936274ULL) / 6432163ULL + 1;
+ if (__builtin_expect(size_t(__last - __first) < __min_len, 0))
+ {
+ __res.ptr = __last;
+ __res.ec = errc::value_too_large;
+ return __res;
+ }
+
+ unsigned __pos = __min_len;
+ // For bit-precise integers, try to avoid too many
+ // operations on the whole _BitInt.
+ while (__pos >= 19)
+ {
+ unsigned long long __num = __val % 10000000000000000000ULL;
+ __val /= 10000000000000000000ULL;
+ for (unsigned __i = 1; __i < 20; ++__i)
+ {
+ __first[__pos - __i] = '0' + (__num % 10ULL);
+ __num /= 10ULL;
+ }
+ __pos -= 19;
+ }
+ unsigned long long __num = __val % 10000000000000000000ULL;
+ __val /= 10000000000000000000ULL;
+ while (__pos)
+ {
+ __first[--__pos] = '0' + (__num % 10ULL);
+ __num /= 10ULL;
+ }
+ if (!__num)
+ __num = __val;
+ if (__num)
+ {
+ // Actual __len is __min_len + 1.
+ if (__builtin_expect(size_t(__last - __first) == __min_len, 0))
+ {
+ __res.ptr = __last;
+ __res.ec = errc::value_too_large;
+ return __res;
+ }
+ for (unsigned __i = __min_len; __i; --__i)
+ __first[__i] = __first[__i - 1];
+ __first[0] = '0' + __num;
+ }
+ __res.ptr = __first + __min_len + (__num != 0);
+ __res.ec = {};
+ return __res;
+ }
+#endif
+
template<typename _Tp>
constexpr to_chars_result
__to_chars_8(char* __first, char* __last, _Tp __val) noexcept
@@ -290,6 +462,59 @@ namespace __detail
return __res;
}
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ constexpr to_chars_result
+ __to_chars_8(char* __first, char* __last,
+ unsigned _BitInt(_Np) __val) noexcept
+ {
+ using _Tp = unsigned _BitInt(_Np);
+ static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation bug");
+ static_assert(__gnu_cxx::__int_traits<unsigned long long>::__digits
+ >= 64);
+
+ to_chars_result __res;
+ unsigned __len = (__to_chars_len_2(__val) + 2) / 3;
+
+ if (__builtin_expect(size_t(__last - __first) < __len, 0))
+ {
+ __res.ptr = __last;
+ __res.ec = errc::value_too_large;
+ return __res;
+ }
+
+ unsigned __pos = __len - 1;
+ // For bit-precise integers, try to avoid too many
+ // operations on the whole _BitInt.
+ while (__pos + 1 >= 21)
+ {
+ unsigned long long __num = __val;
+ __val >>= 63;
+ for (unsigned __i = 0; __i < 21; ++__i)
+ {
+ __first[__pos - __i] = '0' + (__num & 7);
+ __num >>= 3;
+ }
+ __pos -= 21;
+ }
+ if (__pos != -1U)
+ {
+ unsigned long long __num = __val;
+ do
+ {
+ __first[__pos] = '0' + (__num & 7);
+ __num >>= 3;
+ --__pos;
+ }
+ while (__pos != -1U);
+ }
+ __res.ptr = __first + __len;
+ __res.ec = {};
+ return __res;
+ }
+#endif
+
template<typename _Tp>
constexpr to_chars_result
__to_chars_2(char* __first, char* __last, _Tp __val) noexcept
@@ -324,6 +549,61 @@ namespace __detail
return __res;
}
+#ifdef __BITINT_MAXWIDTH__
+ __extension__
+ template<size_t _Np>
+ constexpr to_chars_result
+ __to_chars_2(char* __first, char* __last,
+ unsigned _BitInt(_Np) __val) noexcept
+ {
+ using _Tp = unsigned _BitInt(_Np);
+ static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation bug");
+ static_assert(__gnu_cxx::__int_traits<unsigned long long>::__digits
+ >= 64);
+
+ to_chars_result __res;
+
+ const unsigned __len = __to_chars_len_2(__val);
+
+ if (__builtin_expect(size_t(__last - __first) < __len, 0))
+ {
+ __res.ptr = __last;
+ __res.ec = errc::value_too_large;
+ return __res;
+ }
+
+ unsigned __pos = __len - 1;
+ // For bit-precise integers, try to avoid too many
+ // operations on the whole _BitInt.
+ while (__pos + 1 >= 64)
+ {
+ unsigned long long __num = __val;
+ __val >>= 64;
+ for (unsigned __i = 0; __i < 64; ++__i)
+ {
+ __first[__pos - __i] = '0' + (__num & 1);
+ __num >>= 1;
+ }
+ __pos -= 64;
+ }
+ if (__pos != -1U)
+ {
+ unsigned long long __num = __val;
+
+ do
+ {
+ __first[__pos--] = '0' + (__num & 1);
+ __num >>= 1;
+ }
+ while (__pos != -1U);
+ }
+
+ __res.ptr = __first + __len;
+ __res.ec = {};
+ return __res;
+ }
+#endif
+
} // namespace __detail
template<typename _Tp>
@@ -401,6 +681,14 @@ _GLIBCXX_TO_CHARS(signed __int128)
_GLIBCXX_TO_CHARS(unsigned __int128)
#endif
#undef _GLIBCXX_TO_CHARS
+#ifdef __BITINT_MAXWIDTH__
+ /// std::to_chars for bit-precise integer types.
+ template<typename _Tp,
+ enable_if_t<__is_bitint<_Tp>::value, int> = 0>
+ _GLIBCXX23_CONSTEXPR inline to_chars_result
+ to_chars(char* __first, char* __last, _Tp __value, int __base = 10)
+ { return std::__to_chars_i<_Tp>(__first, __last, __value, __base); }
+#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3266. to_chars(bool) should be deleted
@@ -478,6 +766,8 @@ namespace __detail
{
static_assert(is_integral<_Tp>::value, "implementation bug");
static_assert(is_unsigned<_Tp>::value, "implementation bug");
+ static_assert(__gnu_cxx::__int_traits<unsigned long long>::__digits
+ >= 64);
// __glibcxx_assert((__base & (__base - 1)) == 0);
// __glibcxx_assert(_DecOnly ? __base <= 8 : __base <= 32);
@@ -496,6 +786,9 @@ namespace __detail
// Remember the leading significant digit value if necessary.
unsigned char __leading_c = 0;
+ unsigned long long __num = 0;
+ int __num_bits = 0;
+ const bool __is_bitint_p = __is_bitint<_Tp>::value;
if (__base != 2)
{
__leading_c = __from_chars_alnum_to_val<_DecOnly>(__first[__i]);
@@ -505,7 +798,13 @@ namespace __detail
__first += __i;
return true;
}
- __val = __leading_c;
+ if constexpr (__is_bitint_p)
+ {
+ __num = __leading_c;
+ __num_bits = __log2_base;
+ }
+ else
+ __val = __leading_c;
++__i;
}
@@ -514,8 +813,25 @@ namespace __detail
const unsigned char __c = __from_chars_alnum_to_val<_DecOnly>(__first[__i]);
if (__c >= __base)
break;
- __val = (__val << __log2_base) | __c;
+ if constexpr (__is_bitint_p)
+ {
+ // For bit-precise integers, accumulate as many bits as possible
+ // in __num before incorporating it into __val.
+ if (__num_bits + __log2_base > 64) [[__unlikely__]]
+ {
+ __val = (__val << __num_bits) | __num;
+ __num = 0;
+ __num_bits = 0;
+ }
+ __num = (__num << __log2_base) | __c;
+ __num_bits += __log2_base;
+ }
+ else
+ __val = (__val << __log2_base) | __c;
}
+ if constexpr (__is_bitint_p)
+ if (__num_bits)
+ __val = (__val << __num_bits) | __num;
__first += __i;
auto __significant_bits = (__i - __leading_zeroes) * __log2_base;
if (__base != 2)
@@ -533,28 +849,83 @@ namespace __detail
__from_chars_alnum(const char*& __first, const char* __last, _Tp& __val,
int __base)
{
+ static_assert(__gnu_cxx::__int_traits<unsigned long long>::__digits
+ >= 64);
// __glibcxx_assert(_DecOnly ? __base <= 10 : __base <= 36);
const int __bits_per_digit = __bit_width(unsigned(__base & 0x3f));
int __unused_bits_lower_bound = __gnu_cxx::__int_traits<_Tp>::__digits;
+ unsigned long long __num = 0;
+ int __num_bits = 0;
+ unsigned long long __cur_base = 1;
+ const bool __is_bitint_p = __is_bitint<_Tp>::value;
for (; __first != __last; ++__first)
{
const unsigned char __c = __from_chars_alnum_to_val<_DecOnly>(*__first);
if (__c >= __base)
- return true;
+ break;
__unused_bits_lower_bound -= __bits_per_digit;
- if (__unused_bits_lower_bound >= 0) [[__likely__]]
- // We're definitely not going to overflow.
- __val = __val * __base + __c;
- else if (!__raise_and_add(__val, __base, __c)) [[__unlikely__]]
- {
- while (++__first != __last
- && __from_chars_alnum_to_val<_DecOnly>(*__first) < __base)
- ;
- return false;
+ if constexpr (__is_bitint_p)
+ {
+ // For bit-precise integers, accumulate as many bits as possible
+ // in __num before incorporating it into __val.
+ if (__num_bits + __bits_per_digit > 64) [[__unlikely__]]
+ {
+ if (__unused_bits_lower_bound >= 0) [[__likely__]]
+ // We're definitely not going to overflow.
+ __val = __val * __cur_base + __num;
+ else if (__builtin_mul_overflow(__val, __cur_base, &__val)
+ || __builtin_add_overflow(__val, __num,
+ &__val)) [[__unlikely__]]
+ {
+ while (++__first != __last
+ && (__from_chars_alnum_to_val<_DecOnly>(*__first)
+ < __base))
+ ;
+ return false;
+ }
+ __num = __c;
+ __num_bits = __bits_per_digit;
+ __cur_base = __base;
+ }
+ else
+ {
+ __num = __num * __base + __c;
+ __num_bits += __bits_per_digit;
+ __cur_base *= __base;
+ }
+ }
+ else
+ {
+ if (__unused_bits_lower_bound >= 0) [[__likely__]]
+ // We're definitely not going to overflow.
+ __val = __val * __base + __c;
+ else if (!__raise_and_add(__val, __base, __c)) [[__unlikely__]]
+ {
+ while (++__first != __last
+ && __from_chars_alnum_to_val<_DecOnly>(*__first) < __base)
+ ;
+ return false;
+ }
}
}
+ if constexpr (__is_bitint_p)
+ if (__num_bits)
+ {
+ if (__unused_bits_lower_bound >= 0) [[__likely__]]
+ // We're definitely not going to overflow.
+ __val = __val * __cur_base + __num;
+ else if (__builtin_mul_overflow(__val, __cur_base, &__val)
+ || __builtin_add_overflow(__val, __num,
+ &__val)) [[__unlikely__]]
+ {
+ while (++__first != __last
+ && __from_chars_alnum_to_val<_DecOnly>(*__first) < __base)
+ ;
+ return false;
+ }
+ }
return true;
}
--- a/libstdc++-v3/testsuite/18_support/headers/climits/bitint.cc 2026-11-11 21:39:13.021999650 +0100
+++ b/libstdc++-v3/testsuite/18_support/headers/climits/bitint.cc 2026-11-11 21:39:13.021999650 +0100
@@ -0,0 +1,10 @@
+// { dg-do compile { target bitint } }
+
+#include <climits>
+
+#ifndef BITINT_MAXWIDTH
+#error BITINT_MAXWIDTH not defined
+#endif
+#if BITINT_MAXWIDTH != __BITINT_MAXWIDTH__
+#error unexpected value of BITINT_MAXWIDTH
+#endif
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/bitint.cc 2026-11-11 21:39:13.022124078 +0100
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/bitint.cc 2026-11-12 16:14:08.473659710 +0100
@@ -0,0 +1,83 @@
+// { dg-do compile { target { c++11 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <limits>
+
+static_assert(std::numeric_limits<decltype(0wb)>::min() == -1, "");
+static_assert(std::numeric_limits<decltype(0wb)>::max() == 0, "");
+static_assert(std::numeric_limits<decltype(0wb)>::digits == 0, "");
+static_assert(std::numeric_limits<decltype(0wb)>::digits10 == 0, "");
+static_assert(std::numeric_limits<decltype(0wb)>::is_signed, "");
+static_assert(std::numeric_limits<decltype(0wb)>::is_integer, "");
+static_assert(std::numeric_limits<decltype(0uwb)>::min() == 0, "");
+static_assert(std::numeric_limits<decltype(0uwb)>::max() == 1, "");
+static_assert(std::numeric_limits<decltype(0uwb)>::digits == 1, "");
+static_assert(std::numeric_limits<decltype(0uwb)>::digits10 == 0, "");
+static_assert(!std::numeric_limits<decltype(0uwb)>::is_signed, "");
+static_assert(std::numeric_limits<decltype(0uwb)>::is_integer, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957wb)>::min() == -2305843009213693951wb - 1, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957wb)>::max() == 2305843009213693951wb, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957wb)>::digits == 61, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957wb)>::digits10 == 18, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957wb)>::is_signed, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957wb)>::is_integer, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957uwb)>::min() == 0, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957uwb)>::max() == 2305843009213693951uwb, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957uwb)>::digits == 61, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957uwb)>::digits10 == 18, "");
+static_assert(!std::numeric_limits<decltype(1333217576663818957uwb)>::is_signed, "");
+static_assert(std::numeric_limits<decltype(1333217576663818957uwb)>::is_integer, "");
+#if __BITINT_MAXWIDTH__ >= 132
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010wb)>::min() == -2722258935367507707706996859454145691647wb - 1, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010wb)>::max() == 2722258935367507707706996859454145691647wb, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010wb)>::digits == 131, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010wb)>::digits10 == 39, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010wb)>::is_signed, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010wb)>::is_integer, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010uwb)>::min() == 0, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010uwb)>::max() == 2722258935367507707706996859454145691647uwb, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010uwb)>::digits == 131, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010uwb)>::digits10 == 39, "");
+static_assert(!std::numeric_limits<decltype(1888966882943144259766083242878452564010uwb)>::is_signed, "");
+static_assert(std::numeric_limits<decltype(1888966882943144259766083242878452564010uwb)>::is_integer, "");
+#endif
+static_assert(std::numeric_limits<unsigned _BitInt(8)>::digits10 == 2, "");
+static_assert(std::numeric_limits<signed _BitInt(8)>::digits10 == 2, "");
+static_assert(std::numeric_limits<unsigned _BitInt(13)>::digits10 == 3, "");
+static_assert(std::numeric_limits<signed _BitInt(13)>::digits10 == 3, "");
+static_assert(std::numeric_limits<unsigned _BitInt(16)>::digits10 == 4, "");
+static_assert(std::numeric_limits<signed _BitInt(16)>::digits10 == 4, "");
+static_assert(std::numeric_limits<unsigned _BitInt(32)>::digits10 == 9, "");
+static_assert(std::numeric_limits<signed _BitInt(32)>::digits10 == 9, "");
+static_assert(std::numeric_limits<unsigned _BitInt(37)>::digits10 == 11, "");
+static_assert(std::numeric_limits<unsigned _BitInt(64)>::digits10 == 19, "");
+static_assert(std::numeric_limits<signed _BitInt(64)>::digits10 == 18, "");
+#if __BITINT_MAXWIDTH__ >= 128
+static_assert(std::numeric_limits<unsigned _BitInt(77)>::digits10 == 23, "");
+static_assert(std::numeric_limits<signed _BitInt(77)>::digits10 == 22, "");
+static_assert(std::numeric_limits<unsigned _BitInt(128)>::digits10 == 38, "");
+static_assert(std::numeric_limits<signed _BitInt(128)>::digits10 == 38, "");
+#endif
+#if __BITINT_MAXWIDTH__ >= 256
+static_assert(std::numeric_limits<unsigned _BitInt(129)>::digits10 == 38, "");
+static_assert(std::numeric_limits<unsigned _BitInt(255)>::digits10 == 76, "");
+static_assert(std::numeric_limits<unsigned _BitInt(256)>::digits10 == 77, "");
+static_assert(std::numeric_limits<signed _BitInt(256)>::digits10 == 76, "");
+static_assert(std::numeric_limits<unsigned _BitInt(257)>::digits10 == 77, "");
+static_assert(std::numeric_limits<signed _BitInt(257)>::digits10 == 77, "");
+#endif
+#if __BITINT_MAXWIDTH__ >= 4096
+static_assert(std::numeric_limits<unsigned _BitInt(4096)>::digits10 == 1233, "");
+static_assert(std::numeric_limits<signed _BitInt(4096)>::digits10 == 1232, "");
+#endif
+#if __BITINT_MAXWIDTH__ >= 15437
+static_assert(std::numeric_limits<unsigned _BitInt(15437)>::digits10 == 4647, "");
+#endif
+#if __BITINT_MAXWIDTH__ >= 19191
+static_assert(std::numeric_limits<unsigned _BitInt(19191)>::digits10 == 5777, "");
+static_assert(std::numeric_limits<signed _BitInt(19191)>::digits10 == 5776, "");
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+static_assert(std::numeric_limits<unsigned _BitInt(65535)>::digits10 == 19728, "");
+static_assert(std::numeric_limits<signed _BitInt(65535)>::digits10 == 19727, "");
+#endif
--- a/libstdc++-v3/testsuite/20_util/hash/bitint.cc 2026-11-11 21:39:13.022577515 +0100
+++ b/libstdc++-v3/testsuite/20_util/hash/bitint.cc 2026-11-11 21:39:13.022577515 +0100
@@ -0,0 +1,23 @@
+// { dg-do run { target { c++11 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <functional>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+enum E1 : _BitInt(27) {FIRST=1, SECOND=2};
+enum class E2 : unsigned _BitInt(63) {THIRD=42, FOURTH=666};
+
+int main()
+{
+ VERIFY( hash<_BitInt(27)>{}(1) == hash<E1>{}(FIRST) );
+ VERIFY( hash<_BitInt(27)>{}(2) == hash<E1>{}(SECOND) );
+ VERIFY( hash<unsigned _BitInt(63)>{}(42) == hash<E2>{}(E2::THIRD) );
+ VERIFY( hash<unsigned _BitInt(63)>{}(666) == hash<E2>{}(E2::FOURTH) );
+ VERIFY( hash<_BitInt(35)>{}(7032058851wb) == (std::size_t)7032058851wb );
+ VERIFY( hash<_BitInt(35)>{}(-7032058851wb) == (std::size_t)-7032058851wb );
+ VERIFY( hash<_BitInt(1)>{}(0wb) == (std::size_t)0wb );
+ VERIFY( hash<_BitInt(1)>{}(~0wb) == (std::size_t)~0wb );
+ VERIFY( hash<unsigned _BitInt(62)>{}(1067218502636252806uwb) == (std::size_t)1067218502636252806uwb );
+}
--- a/libstdc++-v3/testsuite/20_util/integer_sequence/bitint.cc 2026-11-11 21:39:13.022667367 +0100
+++ b/libstdc++-v3/testsuite/20_util/integer_sequence/bitint.cc 2026-11-11 21:39:13.022667367 +0100
@@ -0,0 +1,11 @@
+// { dg-do compile { target { c++14 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <type_traits>
+#include <utility>
+
+static_assert(std::integer_sequence<_BitInt(1)>::size() == 0, "");
+static_assert(std::integer_sequence<_BitInt(4), 4wb, 5wb, 6wb, 7wb>::size() == 4, "");
+static_assert(std::integer_sequence<unsigned _BitInt(1)>::size() == 0, "");
+static_assert(std::integer_sequence<unsigned _BitInt(1), 0uwb, 1uwb>::size() == 2, "");
+static_assert(std::integer_sequence<unsigned _BitInt(4), 13uwb, 14uwb, 15uwb>::size() == 3, "");
--- a/libstdc++-v3/testsuite/20_util/is_arithmetic/bitint.cc 2026-11-11 21:39:13.022747251 +0100
+++ b/libstdc++-v3/testsuite/20_util/is_arithmetic/bitint.cc 2026-11-13 10:42:16.259883739 +0100
@@ -0,0 +1,13 @@
+// { dg-do compile { target { c++11 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <type_traits>
+
+static_assert(std::is_arithmetic<_BitInt(1)>::value, "");
+static_assert(std::is_arithmetic<unsigned _BitInt(1)>::value, "");
+static_assert(std::is_arithmetic<signed _BitInt(57)>::value, "");
+static_assert(std::is_arithmetic<unsigned _BitInt(58)>::value, "");
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(std::is_arithmetic<signed _BitInt(574)>::value, "");
+static_assert(std::is_arithmetic<unsigned _BitInt(575)>::value, "");
+#endif
--- a/libstdc++-v3/testsuite/20_util/is_integral/bitint.cc 2026-11-11 21:39:13.022822790 +0100
+++ b/libstdc++-v3/testsuite/20_util/is_integral/bitint.cc 2026-11-13 10:42:30.349693085 +0100
@@ -0,0 +1,13 @@
+// { dg-do compile { target { c++11 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <type_traits>
+
+static_assert(std::is_integral<_BitInt(1)>::value, "");
+static_assert(std::is_integral<unsigned _BitInt(1)>::value, "");
+static_assert(std::is_integral<signed _BitInt(57)>::value, "");
+static_assert(std::is_integral<unsigned _BitInt(58)>::value, "");
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(std::is_integral<signed _BitInt(574)>::value, "");
+static_assert(std::is_integral<unsigned _BitInt(575)>::value, "");
+#endif
--- a/libstdc++-v3/testsuite/20_util/make_signed/bitint.cc 2026-11-11 21:39:13.022910051 +0100
+++ b/libstdc++-v3/testsuite/20_util/make_signed/bitint.cc 2026-11-13 11:27:32.775110096 +0100
@@ -0,0 +1,40 @@
+// { dg-do compile { target { c++11 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <type_traits>
+
+enum E : _BitInt(1) { E0 = -1, E1 = 0 };
+enum F : _BitInt(28) { F0 = -134217727wb - 1wb, F1 = 134217727wb };
+enum G : unsigned _BitInt(1) { G0 = 0, G1 = 1 };
+enum H : unsigned _BitInt(27) { H0 = 0wb, H1 = 134217727uwb };
+#if __BITINT_MAXWIDTH__ >= 575
+enum I : _BitInt(575) { I0 = -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb,
+ I1 = 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb };
+enum J : unsigned _BitInt(574) { J0 = 0uwb,
+ J1 = 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783uwb };
+#endif
+template<typename T>
+struct is_bitint { static constexpr bool value = false; };
+template<size_t N>
+struct is_bitint<_BitInt(N)> { static constexpr bool value = false; };
+template<size_t N>
+struct is_bitint<unsigned _BitInt(N)> { static constexpr bool value = false; };
+
+static_assert(std::is_same<std::make_signed<const _BitInt(1)>::type, const _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_signed<volatile unsigned _BitInt(1)>::type, volatile _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_signed<_BitInt(32)>::type, signed _BitInt(32)>::value, "");
+static_assert(std::is_same<std::make_signed<const volatile unsigned _BitInt(64)>::type, const volatile _BitInt(64)>::value, "");
+static_assert(std::is_same<std::make_signed<E>::type, signed _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_signed<const volatile F>::type, const volatile _BitInt(28)>::value, "");
+static_assert(std::is_same<std::make_signed<volatile G>::type, volatile _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_signed<H>::type, _BitInt(27)>::value, "");
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(std::is_same<std::make_signed<volatile _BitInt(575)>::type, volatile _BitInt(575)>::value, "");
+static_assert(std::is_same<std::make_signed<unsigned _BitInt(575)>::type, signed _BitInt(575)>::value, "");
+static_assert(std::is_same<std::make_signed<I>::type, _BitInt(575)>::value, "");
+static_assert(std::is_same<std::make_signed<const J>::type, const _BitInt(574)>::value, "");
+#endif
+static_assert(!is_bitint<std::make_signed<char8_t>::type>::value, "");
+static_assert(!is_bitint<std::make_signed<char16_t>::type>::value, "");
+static_assert(!is_bitint<std::make_signed<char32_t>::type>::value, "");
+static_assert(!is_bitint<std::make_signed<wchar_t>::type>::value, "");
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/bitint.cc 2026-11-11 21:39:13.022997579 +0100
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/bitint.cc 2026-11-11 21:39:13.022997579 +0100
@@ -0,0 +1,40 @@
+// { dg-do compile { target { c++11 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <type_traits>
+
+enum E : _BitInt(1) { E0 = -1, E1 = 0 };
+enum F : _BitInt(28) { F0 = -134217727wb - 1wb, F1 = 134217727wb };
+enum G : unsigned _BitInt(1) { G0 = 0, G1 = 1 };
+enum H : unsigned _BitInt(27) { H0 = 0wb, H1 = 134217727uwb };
+#if __BITINT_MAXWIDTH__ >= 575
+enum I : _BitInt(575) { I0 = -61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb - 1wb,
+ I1 = 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783wb };
+enum J : unsigned _BitInt(574) { J0 = 0uwb,
+ J1 = 61832600368276133515125630254911797508782837275302959978515764023224306276632966792579100265310761247399417856504034834837841258576687802491886538775473291979151693037174783uwb };
+#endif
+template<typename T>
+struct is_bitint { static constexpr bool value = false; };
+template<size_t N>
+struct is_bitint<_BitInt(N)> { static constexpr bool value = false; };
+template<size_t N>
+struct is_bitint<unsigned _BitInt(N)> { static constexpr bool value = false; };
+
+static_assert(std::is_same<std::make_unsigned<const _BitInt(1)>::type, const unsigned _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_unsigned<volatile unsigned _BitInt(1)>::type, volatile unsigned _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_unsigned<_BitInt(32)>::type, unsigned _BitInt(32)>::value, "");
+static_assert(std::is_same<std::make_unsigned<const volatile unsigned _BitInt(64)>::type, const volatile unsigned _BitInt(64)>::value, "");
+static_assert(std::is_same<std::make_unsigned<E>::type, unsigned _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_unsigned<const volatile F>::type, const volatile unsigned _BitInt(28)>::value, "");
+static_assert(std::is_same<std::make_unsigned<volatile G>::type, volatile unsigned _BitInt(1)>::value, "");
+static_assert(std::is_same<std::make_unsigned<H>::type, unsigned _BitInt(27)>::value, "");
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(std::is_same<std::make_unsigned<volatile _BitInt(575)>::type, volatile unsigned _BitInt(575)>::value, "");
+static_assert(std::is_same<std::make_unsigned<unsigned _BitInt(575)>::type, unsigned _BitInt(575)>::value, "");
+static_assert(std::is_same<std::make_unsigned<I>::type, unsigned _BitInt(575)>::value, "");
+static_assert(std::is_same<std::make_unsigned<const J>::type, const unsigned _BitInt(574)>::value, "");
+#endif
+static_assert(!is_bitint<std::make_unsigned<char8_t>::type>::value, "");
+static_assert(!is_bitint<std::make_unsigned<char16_t>::type>::value, "");
+static_assert(!is_bitint<std::make_unsigned<char32_t>::type>::value, "");
+static_assert(!is_bitint<std::make_unsigned<wchar_t>::type>::value, "");
--- a/libstdc++-v3/testsuite/20_util/from_chars/bitint.cc 2026-11-13 10:43:00.600283756 +0100
+++ b/libstdc++-v3/testsuite/20_util/from_chars/bitint.cc 2026-11-13 11:16:25.888139409 +0100
@@ -0,0 +1,372 @@
+// { dg-do run { target { c++14 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+// { dg-require-string-conversions "" }
+
+#include <charconv>
+#include <string>
+
+template<typename I>
+bool
+check_from_chars(I expected, std::string s, int base = 0, char term = '\0')
+{
+ const char* begin = s.data();
+ const char* end = s.data() + s.length();
+ I val;
+ std::from_chars_result r = base == 0
+ ? std::from_chars(begin, end, val)
+ : std::from_chars(begin, end, val, base);
+ return r.ec == std::errc{} && (r.ptr == end || *r.ptr == term)
+ && val == expected;
+}
+
+#include <testsuite_hooks.h>
+
+// Using default base 10 or explicit base 10
+void
+test01()
+{
+ VERIFY( check_from_chars(0uwb, "0*", 10, '*') );
+ VERIFY( check_from_chars(0wb, "0") );
+
+#define TEST_WB_UWB(x) \
+ VERIFY( check_from_chars(x##uwb, #x "f", 10, 'f') ); \
+ VERIFY( check_from_chars(-x##wb, "-" #x) )
+
+ TEST_WB_UWB(34359738367);
+ TEST_WB_UWB(28737511161);
+#if __BITINT_MAXWIDTH__ >= 96
+ TEST_WB_UWB(39614081257132168796771975167);
+ TEST_WB_UWB(39535566475881661008803796992);
+ TEST_WB_UWB(9999999999999999999999999999);
+ TEST_WB_UWB(10000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 176
+ TEST_WB_UWB(47890485652059026823698344598447161988085597568237567);
+ TEST_WB_UWB(37985637301123963008723772120681536236860287245700899);
+ TEST_WB_UWB(9999999999999999999999999999999999999999999999999999);
+ TEST_WB_UWB(10000000000000000000000000000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 2049
+ TEST_WB_UWB(32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638215525166389437335543602135433229604645318478604952148193555853611059596230655);
+ TEST_WB_UWB(10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430);
+ TEST_WB_UWB(9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
+ TEST_WB_UWB(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 5132
+ TEST_WB_UWB(45454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545);
+ TEST_WB_UWB(99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
+ TEST_WB_UWB(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ TEST_WB_UWB(500882482601711616244768087890063937611956368892437854816254243427723514889077863272376532720233337025259558585726815795455737345529703167217376591190386757291260467979087896991586804860732731995521077276213997642539829739909881215843091800750729242398039027191237222313522701477864259418802125051667890925591531589936786201777943703970228533935680241797537959070640154522864713174956535356257530847777068400960941969112260801490094781122726426890078508769040640619007965948281621175935945738743903442745401153603327173029525621489788095048832757573040700040142167526412911687642009685382365960561211323134340360633403593432272075948650318681239603716228982661813003788923480657045172912699095266033068826816785999539627202823157225283559445676391855270017516320990830538769457803572137918888518336276803278106849890745679942287513720976305951089261462049489098289463377504748000006035490926703389960116009868048504017379422539029931745584472504410379297512783366576724535054845870358856596826634888242422847006039540464890275160090529949025464883700696791800030651160623096277848350116087905966891769686314866167725971636935870804474253191113882352273005489896437905743333394039888098721324394988507117985882478385940926496732228439288435000496598583116222513135776657417291310854793672847408119140072353799943869425784516195335577399047740163647825222547221897021183406489016361222125361833926514704272540527124928632392086015494922641367453407790513394842447850809082124058261605266534050055043946962964352290512622427945455100046820734985861546556082002459330941232953697462029863178251860055191420227594050999800873005976656566122977291996365378944709765099430189819844713060323575254364521715565842321181462850759903889641082596362672163053278703409602096194565947614901796719182127440867817997222670119560807598679662631415244537682465285357576454231981242852290264854296338068971876119398054575289695175493883930560350004887025501415443397445374883081302147438365886751946672601607254190952040435137601279417523418300701137334756998122966826634982910180123059618703820154791725233451433030204087676908587917467406255242255790714837517968547644790310384224378702065476211986642934150251473119163861460209583697636036204421063831801828896587336901284354944881297591258049505027191184592170632756295844383477215356546200093502020559526019117219617911888236331736915425106115265827809505283647173633050029141019081755768573106512895702767596754586331141908906487857508009358185195219764070915851741257711056463991759817967365289628448346618924937142167519955990151098369712715412315076236265435853091457088036201681669210451770938715552852059144950740300006860331109608100582814350886254838107194107720058212713971522490693614541170214468778951753685940966994238762497910999571089322603844535859711825871065475847210373507841534963564408894276333895051655546394265020637822223333056609070496209653309892669047852409633458093585939707714808430571161071999061401369233107249608163169344593293322015802688302809670151168677107012791622177271192572802040276228138899580591561217139162850671160302423745647641379804047026085306709749070767913717131384228712574884918875988734592963351475024046872368498220108124093291438450918396677543945998704617949624561737015133020499016545858503119024159879944505360299938136676020152124836044564071273181630927474662884865548251151841126981553243979424573473091753792748022882891953609947812118926559451150002479573330326720142511647864596802022004221861458889481564616281190771787141578382233541529372654381667873168044032082711318484117311145723142847219459764075120620949959923007305553871536475593369555670630409989360200431786036544889806543770972255018542481559575070571562321045667810851437856047142498568082901749678246720692955154303613285643736003766534865792299407295376644936381559047806212015972508417268591497306587391028666375765741490049930159050650880479444185167194365887343829724896966570531367449275516436808180343229536166664855468000868627235707727883797317778571777094039805595069151331955837915388787342343944616667536429492975306779453195112560006596189697084849204490737672699704280422671732384562132457505869017113528544534777662140059137438556874307751903782967506013477627728454460930447855632146858024631239469508670925834454605361004284672031062496104654532317799633328845641830467605382657799437133803667738833656584152716166833073102469962314172777379035904650387227435060478377405760903049032041487629666505507678903421183091165217226253565978476628765977049844713079591264974324781351119860856291693574914952962308287888818220818507088172110602188202820822495156478168424886561835385833375036807857653187597576849283813017334543460830737675262265466884858282696199503913782596189538921309054502604912563899045483746578978308259024115476497559028170299005860460840833648731907986525429163228455929295598574804068134615444016423635574469267845799704259241147172452965802744225088933971156116208926572863263189275319718006991341119931006351362033187097948532206605958792987299302449286484221884299682282707934508477754032136853844344428987932021027906899296596231055700593360481367497995918048032821758896326991735678354097758470688579653410872525235799352261832753619074965431356105838903059358928956483345701246560973124555695178987940689461777368779758370560353006295672178432048276063369549032110044119882876264277680743578642478805862910780462164393946632049391210877239596180730883639866130303957914437867824677056477323163909709162780170485959226029063167177511140060926050165927250485296389290118011160924233212515011732035126779767315348498475683883636391867578725971505506159987065125440607992326410166591656522551762221859724726874538216361095465729345725262955217484095665467075978818316145321695701650334375024148341156286522930795078232586969355308669779613697827777474448662054230626407349989198370950424789359925134385533621468646714011821687766355835473459774777646616398778411515263789209635304364950451783290903143269902792085965941916826838645873697447079082532310200209089206484789278282744507629110429170629586643418983549521239736985245823125021597444640873673303118356525765678436269321539230649157143464476383310160462254612832071158177317438457716827102285561914868609993337032702746599854344947414252671756683540491799147899897134458705747067531401460591397384922576618741396036995327749289385510814098944017621275220394572852062694434639947532282351827365696486126464853068298703188306288081200375866629762057240351661722576275627729059442612121557557372241677845138901989155183112343343506959191825050752903806752230460878913030344803937051714839230197553625569283274996932364899238204261145545489020241452925699515667472801265390185581421710567826573752466105463367702601782229411726637709032479173694505955625697416960872299852414340426146696560638501735629173494823156178631236352214605681538438815017976084082299093944375544001298950173461908947396719622384218030724639451706629548175908024870038968613893793828184117855323884123521096396653802003028769768767138336122314673320964913253318011742673642886739838414642947223715583323116300683963297133342737113850834141339247043145632229514158872090935948337102961395042082956919208661572998901378367509786969202160080657404160390166877038427661680777115491061884372638436201329556500677554100245146124381505758910009520868013287485293241434196266605350210674124275810479795530303301734942285980842093677307066934677033059170021731175872896710247788274578853015891530796876076366884245807706991614354405201648294316421460420459491526536240858136027926735425055664454339587814955270192275490263057315969936262254813577975155140476644363104047978296883496012335994205827574616473329593253952398130707301705215557583146320029816624078610329110693250809448068678082674104287486383065258868786407822667213586356717447111935745444373427529403662906045904170063703824083827122712485751690913701525735023673437652461397139510992621478612396111269994624261395887671352186290829116029520780769926097462297626646896606452684605605147797985418545622613175072065995764487514335427871757796785708546124788364175728820026121286294013826742860440342145596025696914831165672494604579905078065605294347869302001220894583392301133483988313641224257139647433876437808782384135125710520255696312194150893561591668287170069871513111445668406557713244566264278656211648978552569530697235362040998743470471155692061212905512954269180542465816425413579229935662807510439332476118384418134211448188591353206638395464511710017341929651255017636811887100201382606237963623816811815336829543685545019643673366361784009243971029507352009904186736572135169793034650306354875954926134604317001599705164082198209895677127729989709862074443911788006533217772381540854426787910724871988391213638388287188744533502491213624658956211922647508279240325941531980866080782426657102826856761550508003342087596356340078409190893803151176856327802308350709370737363276181854742321818893006903818067070844185348356413163320767117499399274437501390222483171256262303221017068534970407885114122587693967920018513921431005439671359763307033442676853957689067407079238921856015131931621463262652839096212991479742162399083892054243859405357694666483682612541205608241222817677474519169156417879317265514703887416595643457318545520569740171122055745848704167746009756070878576703441813365031501817315742367168187698586547609999154744902982187629860589100661075817934335397820374014042088497047142371011335577856153389981318082516220406866680880937808577973360529721271269839540962248621886189082922303467418893575684488446315635582256220261795484759305166723675551064709223960234999613390237217486708463144918790470539852745406229685453341181741280995169390486978139489361617856967156013437644026051066787341521245059568670143995647832751729985476162976632792977231519487279804486601838782408466130758918336397008328299270091364296197887608163724889926465722071716651654505470562150536249993280541034542663370043877609601656103205700904162226064344410239081620706314601917261402109872581322631584383079127271920334153560599577382701637415469845487280008479872373516283099704160520022098888735559274183710018160676425291272268799038842546566199364095296964043864278350118452690690753738327433793545163869778165234508577844633133220883338006233591494782335321213742736706582268957548268166334445639828582777740962013485214820997226949052619961979921719134996869273978197181868968609951694956242069568050231612486139845103652192660485452610189567451422009737413654146995976165146911335452572476798573255443629994026123760799210375863878511205232233344664340763207654997519437181730749652069763292922969144715227235454264498351222554610389947773169215699149395988120981683720908686412921754041560160606060307240279502653920585634848045013120863680944804977807148978547969372948455835002519532081626677570445349007280228680025236969688137815843221055588467372516981916127908689525298468829914310530369009571193693642926144652604346436977825477145969472538083585753251320699259645089953795732400076420653022987735934331363542764095971761882237640990257460910340233910408147352034495377923334654949334955417690251151995024004006205774235760951739155030803412535137396562653820647008255727096453119617328930080808400474867359411931680469844206607957095650891130174867157554012218632106090898389655583376558986250722639645402818835445937613984031532713160207012803468294372550062388184683646489101290207645763442683133492888155111176357393384590278419380792493185073235418551105812028468768907829769568047216013343673553460542482215735119908826287640197031591551624307814394754899718260298906556835932225129140277773527936319491370697617812645499769374515955389844221386624705734746352072831282269119596580623695254188372923372322026050753902570846535956844540236585333845894585191328580354287663969386955063113695164325335569367654186060492238153291068526173868655370939072074942951046696271136741404787727173968562796108959326647737865245112811852352843474981955623245841949002753846774032437426391575409326800687683689980735948098456106855296539559040329471598138273779297105324627076809564932286035562894850970752839770832912964558741805314905453126764528439873881255686818668592471782981667692324799771116790307184714614396155681643332688433893205987904241043799668753170436357330934573535956203594284965476679164393236451951205139877970421797018803242958159110538834196937818691735197529264377454893771140891304347386044968768630963613800033393008333094973768598476328229553063814958447727365907550546338462213706265724428904240965178095692931405328365137350442603395432982940842534083063204781886797860862730177962209591704543565835737402967522875762291334866190929441609780199586873656849455542875522667547575617440537819630489035517701615407843309129463494073023006375072240503242535344910009513933737317268383786490302168699136933423239693407158915035941991009607699216034640861950332065321147296224632012012211045205409855993503590725870416364528613591615008122654690759875589100511132687052560341723799161055334800189369782170951293787658665642347984435070878018916565207472622969321958463044630698011442961741463819697611890548165998002102325518918481340933907097707454394475538300526602404343320899623516663035299545952721128864943223791143032974449476872985253287092136159904226151757526899204733435304393997041281750190315697292377601578964409383696855017555512767722814403090414506701703964624963157866469521654200183316169207551597924300766223601407048851547671310500763365789155472831827267421838295410273628572009151498805062062221677888607276180482283562086609676342127162187274794703167641416346797762430455010592873185041115235864961348134176533052654133271415505297242058501438168871525369248422184552396138052892980869921722040213407903965720037598987354632372306768602707051792325846954521234051004563805567752746413361204301867689004811478899857768237394549469647644735013135030716879285627796089109296013390756045306368316523325677599492022766234818180670758852616908147838819920959426254963808655305714602639279980432929492451084829426937688906764011957944961111909390063659258342311778555203879993422842993790810325687178049965851137062131142529638335668816178994577682811415857451305363873539063181007228833338587335304465509251815078819967692968122808623619286977380183690346356371327888193325257585619208966374023430581001788629532433173020264606022639431411450920365558623297427034724285824957836904449919928113445577675934787868469673029796891675079830320474200830674148614821552651859706854229866290566908135166267720267757598544715141223442454183539756481298652955910736413167343050788876175053399711573189503131928855504157488715782581228077757406980930974941604200874285306631982976909081534203536379094164139959947122345433270667194975490721733074149344987982905296803863821848542560917471398472198329186133340779885379601022070953798355308530705007737578335262676190039996996368132297666305619829928860082948709209343305205471443335405964110345175135478382561485978375638632971613699063065062940732093582616275590264395878637684860834902554057418865353945281799250434652873569875352813320155313693952628243022116315789523701658421917536827683385179427719153983964203524553241932689799345743360361314172192713831142722239580248455858025679556028690933197839392153855313212414475833773288194231376461411002638048161126328018439071936249540911583208954035082543953491839856831922612230090470096688738937951722514633231800373480875131461286676745657137064470816849683805114307059822551786205554971396775724247983968268569453789939405191005987810965050508149149062553144587489427521406596529558453329627253671644266002669069654395943193223973186509850982584317968462634228239281678766724172123470221285735902490503241689769806270568828453212462881725732925065784082235523949394489831908882790516688372162829330968109687015878328628161222491897457203231370019106296646622560277781825339299295345400645794626733061001999664158842886022113716598295427098933945199764932709773720451015233989797726868490226102537629080437420353025191429794370941838937750183404230596634357269864450800010584363201891538260732253623945157408534595887945899941177212837251214243424491309673961498648898022677264739222862785353171126365529486256652937541732065062737692694552987608154345805890609400444199840699024842243797848741258339626788854609114213154168560922230092759373832106481782902634458745185184789658454491914606314509184301617337812163059620335415952015376426207264972674112984110004649280106430751829102502479246881065094340544440857655404186221232702732475252379493635391062801205521678646712313783111066694281965932052832884056075272956097810845053511560555837288389879222704072121997497068407611343108043570053938944491755416579261992432043120848210253910568626817944817349982435077018192598753395386285623512256634026456352343278663276235845621094929651734303611150206699500617807372351440463473050856402075674263219155344343398598556028676768518225681365326839635436422854861621906089420599266425796042116885183366586573418495905001010350178513569408120033185550671348424717446901752397512171162656692840767744955251639321275326650252695158435836193268369663470435670307685941516660828193839116644650928798230692110114568320810952053210304694033010615116225200263682856687315206730538909351371560429257756979999235661405238904954113636915511255602862351187337458051701797838191996686953364550964892603366544484307133735007907899886023421022393133359675746679457442593333201700441159875522505985482874778752276319205279877749765791537577896395708895651794852513132145902842490325860697543452946853015322045515505815962465378914112807511948241890904586442026260835442385766884510278482138448132310336834870262633006427182046576822789727833985503690468166072891009092981900576570960162606360435583866137496763829681721981606025536840924656365936789936088735860974932512935631277719339471597736703024168357038146479981214410122013767832453574839977865809979778489981688144089751861643202547951460451835556933680349430804557942929229100027206528137273340296695143930597754546542137277125221318068593553021631213093114062174415561346204824667782363236378874257646479826799624276353545409242244032781686006752412166886483641764984248866125139730407011994091421533329140976848925818008597293853816875228752799714218177212048882919232920318223035757844204504111369341879588374464481069115838540608400281490063027375403066027586520866412058899483568514217212306114686373444188030081175950758872789386207823818972984973420219081921359692389423720355711077999648925181880348294209457942584782605765239749784328671142252605523790491767626605064183468361528913819043998181787969415002559736190134947379236427200682184056280269056022952516675220868684401289071383485891460939067810311114412915766021484876986887730115983061300633865908611197938915431490546799819796643872714463237503210057258765378734327526752361537752903428105940356680635433013989800695532331431486786604306244330329095461331638819901067635467874059146313114662233313536265660584471412866167651074641195492115398415822238574945180635566197600154004937993751865136287515072951659567874254027746987834158442844608604048513280361322963795034143889666903754843257422983019030002313766270395818877124835192199313092496755891982756701034186429739160357963169763679292490747590753886411272511200697263925492082078407679749424788291669802239692143072650228868229909095418399168489993927581503892980059337145130282029364652516288149720960778627973720138032286443924786644382510346179281144491262043964098768223834384938955521944376518084861396973976429789183);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using base 16
+void
+test02()
+{
+#define TEST_WB_UWB(x) \
+ VERIFY( check_from_chars(0x##x##uwb, #x "g", 16, 'g') ); \
+ VERIFY( check_from_chars(-0x##x##wb, "-" #x, 16) )
+
+ TEST_WB_UWB(1);
+ TEST_WB_UWB(3a7b4065e);
+ TEST_WB_UWB(23e2c3000166d905);
+#if __BITINT_MAXWIDTH__ >= 118
+ TEST_WB_UWB(15787be5810d4d9a633aa75dc35e9f);
+#endif
+#if __BITINT_MAXWIDTH__ >= 575
+ TEST_WB_UWB(59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3);
+#endif
+#if __BITINT_MAXWIDTH__ >= 2048
+ TEST_WB_UWB(7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
+#endif
+#if __BITINT_MAXWIDTH__ >= 5232
+ TEST_WB_UWB(4b0a92a87ea1157bb05adbcf68b78bd6d0222c711d92729f2d66c125281c9c73272e1ba5cf31207f8bfb4ef3b3dac983fcf6f4198867b8b5cd7adaf5967668bda4836274b482f33f7e4232311cfcb418f2a9317a10ea2fdd6409d2fa803ab824bd1a98729d8cb11bcee44ceae00002d2a9334cb91d7b968184687c04a23429604ec1d2eb4d83061b67520547530719fc3b65b658e04cda65b55669578a92b7d85489c4a10dcabd741dc2bc70cad56c053b225d1b6f3780248dea7b177c33f0d0bcb472c97e2f3e9bf1fa0bbbcf78c00a9a1e260955a62de390a9fa0ddceadd989e4f621d7ea0b8709ac42b693cec74d60a9ae05f400d42d1b63dde9227bb2bc60b8de3892d9bf9c75f25309b11a4721b3e527a7f5fbd5016fa2ea821e9d3e7f460ca7e8d667754c59c8561ad29d3c8682543e78400379afa65431b4e16034377cdc104333859f9d5de5a82072d4b6f528e56d68e8d7188f2b4a341caa68441744546a77d9fa0527dfad5842720f479ae4a503cd8c1c4ca75670b3f0e8f8182d4c7295266caa4e3c47967ec995b6547a6b5837e764748ebaf542bbde3ac3fb873680ad932aebcf72823e3c17f480925fe8ca374d4eb60833f8b4023377fdbaae7e5831a933f11bb62f47de13c86063a12a9afe6950f69d49aa9f7d128d27b10b7fe2a4b3d3b069f2f83816b0987a61c315502c6646c9afe1592cf3e644a4e1c48786785b36d24e2f1a54dfa2df3165e481924ac85beaa9a5079d8b5c326d10b9e389051a5b533965a81918774a7e5bdc0096945c814e0188db8cd51df9e5c7dd6edcf7ca20212fc83a384f84b69b50b731e513b323153c0e92111c8bf6d46965a1512fc1724f99bc87d9313e6481e59666f9499a0e8598a096a52c8d7985e32ad702ec59527605da4f3708b3b8ee4);
+#endif
+#if __BITINT_MAXWIDTH__ >= 32768
+ TEST_WB_UWB(5d1e578bd611934b21b43cf1f2e800989ab3dd46cacb7d8ac94c9980e7c52dc4e4844fba95e205b69742a7892aa821c45bfe0a25c988af92d44913bb0e407ff2c4cfac59b1b21048f4b7d21e5ff3e3baf2ede0bb758f4e49d86104e7a184d9655386be0438ce4d2c861f4ae5122da0041b80c0900f0edae86fdecf1062a875b52e33ba660207928826dd6d380a0d3d258dfdb69d0b90857a6e548ad1fcff862b324091344724bc6d012aa60b37e331c5e0e762eb77e765e53befb637ee3d62207df455c5181132193bd82473bb55389b3c9a86b381eb99bcda4ff3c88c56e90a4a3ecf624f017b8bda9ffe95f5363131d0b7e551a37e0d7dcd00465a562f64a06d3302bc347d470e1d45a4127bd5434b8c289c2fa6a9ad74aaf3ce002232a18f65a34b992193a83ed84c505421939fadbc3cdd62e58ad68f7da4909fd6312e3bd479d5f50c7d33e5c98339ea17d897d3147435fafe0c897bb0191a874a48c21fc29714ce1448b3ddcbecc7e2c55fb5d9d3ebd3d2f75d4da776682ec1b0f1e07288f4419d3cf47a08e142eaa6a1a07f748b534682b0942926fc58e7ac49c71fd1bc606ef854e900352bebdbcc8b5b4016ae87985e1bc18417196cc36233e234ef42a2e8978be8ccb6d3a8825e03c374b14a0c0f65ce937ce7ff3f4a33227e2264200afbacf3c862c670e52573a89924f2a6335774c6d35bc612a5f934231b99442694f0195c52dfcc37043fdf9e63d1449628b85dfb13230eb91c42dc37db205d701076cc6356999a5ad87af83c4b3cd274f42f6f08527dc16ec09da69bbe030bce7ad831d071cc2a49462385915f58055487755cdaf21d48b2baee4e78f259476c31783ca24466ec8a89711ce9c9213d5196992b89b6733b706289e954e330c014a8fcb7ed62a377ec1493d5deb5122f4bab5ad461cd10d12f99ba837cea4391933f4880a2ebf78eff8b63dd40750c8b2066608134705263090de786f72a178a6a5f0a0c4a029a498dfd27cd723358929ab813ce286531327218b86a43cff4ad2effb9780153c18e50e85bc21cb354b66c678494ccb5c63fce7ea9114d9dbe7b9c77f39dcab52b1a9d86dcb93a306fa697f33a63a901a2777f4b88cde9464885bd3c2387f14ea18ed57d480fadb7b544abefa754f04acb7095533d7e99850456c127ddb2757e414afb8959a8400eecebfe933feedd0a5e735d9bf1f621f54ce21c299592a7d6dca25f364a9f44368b42caca31a7d58f1a322b0c294c01752e1e9fc3b046998ce9f8c23398076a234934ed7adbc20af6f535021e810393af213273d1790c5e620520959d27ffc07133adeb0f70f505652a0783ab0a165b2c49cefdc2da5b24df7cb97ca3b93c14ecea00fb5af500bf200742cb1258263ea1f43b63cf9787ae13412bb6fa67cbe651cbe2abc0e26ae0eaacacfc05d23aa6c7750a960c91441fd26fd6ccd7a1b3286c95d42c773e0d61ebb95df08b9796520da0e819322d39049c0fd173b0849c1c19704890ae55f2990e4f899ae720ecf4c0d50df20246f79e55c812054cae21651e6af5ccbfe766ce37ef681e0f5412d0291fc22b66b9cabb81dcc1cd8ae232a84c28740c0fdada46ca4264d99676a9c0966cebfc25b5b7a79178741b5ba7c3a7cf38b3de128d25dccf89b666005f2696cb1192f1c7499858c20c741db337c4826f78618205865ed50f143b0f7461a53f7237303981c89243d50660883d240bad9c6c2fa2f28d7701a2b2111613b65585ee86bf6f4e51b2235712ac9436b741d323707515feec16a09e27b6b1de0b36cc91f53be046ed039dffaf323566730889e47d9ee269b58207dc38b8ba43ef86d5e4c1b52baeb8c8ad68fae3ce6eeb585269f634d2abb6da88ee92423181c906668abb91397459e6dc54c9aac2b502141ef948f0a4feca2cec5d6f1dde382444c2dfd5fb532fe22f83abda4560dc597ed5a16f7a9f39a68b9615a8754dccb910ac8f0bffbeed2f41990986f9e5df78bb80e7351f20dbaab7f1522c3e1fe54ecb745aca3247f973e002f9dae8d852a35839d87759b32110a4743ce39322315e968b28c9d3223cb324368d0c0edfaf671887de723b0082df74bfc207e1f465777f8d4052af7d06d4b393e0c17390288b1707fd520780327b3ff48220e8e7976874d8ba2455c0f80854d8c9c768f25280f950d200d0047b0ff9fd2fe1e4c649589e047cf3c474fb184dc5dfb5b73235b08208b0520c2b61052890e70c563064f534e1e8f955e411a2a9f15860238d10a595c0f7a2eb58a713e88e1f3ebf8333f3641cecba00fe5ca9efb409124219b7d7d9ae79c40621d7eeaff62c6e796062de7c4e987c4cf4253ba92e4deb4704c220b23ce4b85dbba60cb1d37b2a33dd08af2ba02b789550b33e7e0129c505ebe5b827c9708484179135ea0c5f1de968cc1408f78c9d4740dbc541048a46f06ffe17386f9cbc862df17039508d22b85936c150c35e97033a5c443ee68a2e5589468df8e2497e0f3aee488a7b6a43d4a004246362bb669c17aadbfd350952be4fdfb631283440622288ec9df22f71933395f696505d3267070d643c17b6fa6695b098bde4d81f06610ba3533b14e66ea9dd04f93a37604144c47e5b7a78c20f295acc0d32eb1493f7b7e732cccda075aaa56fe4dccf262094a47c0e1c3e1e4598ea53cad6675ecd1e45ffea129f60bd44cfa1209ec741326bbd4188fb5fcd9349205d1f87bbeca600eb90138bf0d0cfbf71f05e393190a4eed12ce930fa7c7a1ad999a29586489571d8a8fcc978cc88eabce623ed77c7db48f4c479ee40f308198caaae12f24484cbec8094654c1c4f080372f57a39d0c22d943b1bd42e24eebbce9ccdc1e0518ccdd220321e3c81273ff31cb92ced7c5a81b77556e69944a168e06e29c1c0b58e92d5c0b01141d75134f40a60e186ba623e30b824c9fcc531dd335a9ef30f2c85e4ec36f62d0d47610151c1e2d87c4516acfd3a75faffa7d73201752611a1abf58de1ebbaef321bf084dcd35c5818720415ac7a0fab21e6dd225b0333fcaf29899014437f475e70cb3b4327935b999870451280f03366cd55c2d189be80b24810c68b900dea00d82543ffb89e98500edd628ecd95f59bebb76c7475ec26bdfcec498cfa338cd258cfd2106d6a617c48c30a1559ffb044b61cb82c08dee905ca3291c4651e97bded69ce5bd32fd71bf2e1314be1e18f97fe47c30625ad0bf0df9db445bb4b02a8b4d00388ffdaa3f2bcd43d9db6cd34b414f8ba3aa5c62a8463dec91e2accc6de9cca669ca40a8e60decbfd94983248ad2a03e7cfc911532cef1d4a19e910f885da5e217f68afdf477bdddb130f24c03927a708f0b85b1ca87866c16176b9e7511808d080b8afc7338ca3469bc707d4eeaedcde6738fa0fb060d012d68af927a201f722b9a7eaec338d33cf543aa342e880204fb81a5e687a2f7a50b973785b756f7d2e16671b4af44e194888bc8a703caac0f4c41e5d3e4dd78f064b0761c076dfee8d4609d73b57f083dfac0e50e9b810dd7d2e3abb7c124a825d51e41dc8c30b5509152c446c1cc84cc8d69cb18eac8f0bdac9c756db11d93863bd552b8061808976accee2c8962e906cca42fa76d106519acda776de80ae413d046cbd65ec47db9815bd60abecf117b633112d04177e9ee42514c3a6c304e3c771a12c5de807f6fdc456a8b047bf677ad0947ee8121dcc37318fddf494c1bb0562e7624aee5847b3afef63f6aeca717e5eef66700c33a83ec285325646ee5ba8d5bef2c4163977c528dabcd6a52d55031cbb7429ee1c67b1a19907e88763905d21832137bc98fde572b9bb17e6101b02cc8f2bbaab926b4c2c7334b3d6c510f748312e04c92be93ce4a553cab56ecd81fdf83ca88ba7f5b71a296af0ee7be736ac163b764124b226c905f07f74bd0071b63c1a41e40ff8fe3862ef27ddd65d8aec98002ebdb25486b744052b02069db842b7f926c6f125fe53142531ea83bbd71bbb05d86d595f249d64509f6aed57ada450d36a41f868950c8ec6f71181ce2c3cd305a92c64cdc9c81d69330ac0e0ae11b31852ac81e7b80fadaf202e7d4c6a5051137cb5e1467efeafb1096f91b78044d0d3f051baa96068588096d6cc01261e14a3d3f5e951f49802fd0793b488d8845bc8d51571357dcab514a08215c6a02969731f52c513eac710f25bc47a3349d5fb1eea6d546837097cd78b919d2bba079fd95964ec442bfc3686c1b0b90a85b5286f227cd75986533011e4cd3d9fd4dc782e4065726b61a8f22258ab2cdd60554c82d124db57770b695cd9a6fbad8273dbc2d84d2d3af51f5c4dcb892a2bde77aeaf9b89071295706e6e16691b98ddf75ab54487ef3aa74c8772d5b29db3294b62c4d569d66ad945d8efaef3878beae1412f693069107cf08251a21f04cb6b678f40d066aaaaab8299597521e56002268f6b56f87bd3e8fd248b1d29568890e6c8604c720af7f4a45069c535c9c75b5833b250ae8539aca9c4c9d21a51620019c34c8bcd437f7194e836c9b2fe250a31d75bdf5c948b055854d872a53a73befdbf49cb03c83c97b173606371856da25cc881b85c0dbeb461962707d09ac5ce590f995cd7d5f3884854ebb9d9595b3621ddee7eeaac324b42595213f318e14d277aa9fe4f9d8798f17251cacbad00ed8aef6b749b9dbfdef712f1ea2ad237514ce14f9b7ed6336f49853914323a01bc296c30c40aefa2010193eb2b65237cb104cc4d82a280f1eb052a00376401f38d6e23527813f47914886440ed87bc9f8b88ec0d2b6cfe16722916a98d189d1b86c06dfed36177e8e9db28d763e476ee6d62fc98cefaae4023c5eab1dd87cc634739611b9ad80384b32b5b160fd1057c33011401fbc3421f882cd065b39cc8fad529156f0118f3b4434ecb531fd0cf52d1e454cca796eb2fc2bb9475575c6f2c85859c869d8f3ae1de0534fdd50350a6e7a4738e3a5ebdfc1a517171ade09e32653ab803c9f3e4a7f818a5ce1bf5740399e791d3464fcf60a040d14e206f8086a93989732c6d1a2485bff2a0b467a34d4e35209484eff4242fc6725035f3d6df2c5f5258cc6c7c512c6ff1e0d6952e24ca4eb94e3ead726d73e5bda9d8938804f2da5cbe46d80f724701531d96814260cffbae0da8207b1c0538c5ddcc4de1be273d7d6d168ce05d8d337b23b4bd8383b8319160520c7c57444135108e16cfb5544c236ad803c766364289eaff0d6db73efe18900a94e84fd61d5f64332e1a877a3df15340b9b976fb4260fb4fcdb28eccca1ed65f06253523859957b3b3de2ef0d08130893aa6847c067fccd4325aa0fc78765b7f9c90a2212af9d4ddd802cea883fe31bda5b53aab35067f67601f63d896bf57324ffa5379f32757cb2a2573ad23a46bc85aa5748fabf3f60b1359e3a9183bdb68352ee1285538f47f5d672d810c9849663dbdf5e8b1ebf3c444d66d5d1148c54676a66fcbdf634b3cca78bdd610073c4dc43135751c283961fea6be10ee83566429c53008287b45f3f302c903090650ce37854354ad7db5ab2373bb12f612761fd7a62800216df3146fbc1779c26747faec8a4e990703452b76003d6c12b38bea5ab3ea7b20dd909099a7095c0f5056fbdaa495e2a7da0d1dda4a89edfd14d757c8c1d3e89e6378370a819319d1e915ac8daa8e34849b515ee5da4be2ef223ab7e30d9f817018b97a994c946b36a917c353a5f8d74049352524810713a341ca874e6908be81c1391b0ecd8644769d07c942ffa08249d5a76d56ae80);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using base 8
+void
+test03()
+{
+#define TEST_WB_UWB(x) \
+ VERIFY( check_from_chars(0##x##uwb, #x "8", 8, '8') ); \
+ VERIFY( check_from_chars(-0##x##wb, "-" #x, 8) )
+
+ TEST_WB_UWB(77);
+ TEST_WB_UWB(230475202646);
+ TEST_WB_UWB(2157434427317757);
+#if __BITINT_MAXWIDTH__ >= 212
+ TEST_WB_UWB(25137136463562376774153767115327363064061306122026717);
+#endif
+#if __BITINT_MAXWIDTH__ >= 590
+ TEST_WB_UWB(52520315450745642555674717372122700527123161473376502223641763366167532676101223667262053103273110464342371375366327514736450627345155327267556061);
+#endif
+#if __BITINT_MAXWIDTH__ >= 16385
+ TEST_WB_UWB(4204672440352274665474673642642742254033270056040647227124574166633012236544175320133357551706274456527456300064002355240217127547342035703710105243772763055637533033316134157167631571023766516306166345277317727346557014155444400535041326630643541072426165400040052744241137627727060403535401005124274422722132656323522423133142575664164053454767412233522214765151204472523155750301212643630521471361226130112252457405617256321222346463126167130215567613774536617017210141744635013027576241021725653117544421722317052255431345533546143115523245011137431356700107076554315777406421252035720372411723567155230366624602314603405670140740134724357554726757642077070670643173421441444500570556402265103534347221116411605031576740504371431605056252053260630202501237044622265716374067702756307722223330274012024554623056640060130437453216547156437206212275435430730470160645626075414405216712602544770146555430537562513137113433024241473521457675521754640001317712774466272054110115401241031414446441653137620356377056402155531022414742155043322155742472106166515617103122767012554033221353445512167273612514372130313121171270362231602021037561362005126462240354176401332332645463057375053127362240572535416355467542302245044131167555406131346625317466512200210225565311342106065120535562047357513440037026302122167245271357547222653643643414140771761365556521157011443032664635337550124242342700071334233043152657020444332144447574066442331730043202566631577645131175573623364037027361463756424632040152340504366472703370354602322540656301157574764334540572070273614601750565677520603276626424225107236605206440544146465050413116522623371510677542566736021200113576165563573124257774054125231353475370574276222055602267603425574202422134665633525304077720624673522535504756263000151034427777553120111777447152510051716217643545210514073344005155342354337006640125635627352727171002360447732554103510543561317104063505141106417464603103105023120727610255351202456747261040331675403206467402335444366414620613016716561530606217271130704446650401745275760551424436572644723724101641417623502634001600570314507767457674163040540776210226451244165342412470763406060312136301023077064730472347454441731154372727727153626710717513031077141227142176447022133576552110316037605230444517543615674125665540167161143551465106352627456710044762351327546765715736174514576305300043014614070342375021475570311204617673566042057710215673260673611732752635376506603463616605655773602563233262335330260246226355546104112061271116127204175763133710766243512526115420507614355275316325231336412520453507305047404631031757323123520121663673637056111371475417702154775124361162702502475733723144132002060372641415566471655412414373650205477232514101143332504652534466553002630666547332773406621110776102214243325776652744470210256040304347162732511667570100670071712234345403324132761145063625466670150517505636372537471437310561654146707307327120770757145545046352243320527255114161507266426727005722171223300122172600643263375626573020354161162254056443346423670335023336355264353717206665464516660267472101232665676251025155375410751163624622716610662455041260645101757527636411346663112547322250150416370504476430247042045413055210343574567162410317003542605246761154026040321430742105072657206314244105070210260245606227376040036220431435731056001704674777736430017332112144570226064116474400671714241224021344170213067677477772011014466726747667033533032442205154546377207272340170335077265107421777700465571722022256544227301713203705227316122766115530101747070753746672267015754457247476371436453631635050426125020244511153250641173431343175145662121506506245024615521007001201546312301020713055236406100064021302016374466542634052724074731460164470363630136115227115167430200514155371573631323101262416064262770120271401444603625577127504261257206215611446634273014135634036147753154411202676174074237706721770100004566347416410775060356457000113222241104112046501135720036720104604570770770640574424264426426640130701251366262646562235773203031113731021346765601532065720467327501033464761141503521445552756602366);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using base 8
+void
+test04()
+{
+#define TEST_WB_UWB(x) \
+ VERIFY( check_from_chars(0b##x##uwb, #x, 2) ); \
+ VERIFY( check_from_chars(-0b##x##wb, "-" #x "2", 2, '2') )
+
+ TEST_WB_UWB(11);
+ TEST_WB_UWB(101001101111);
+#if __BITINT_MAXWIDTH__ >= 205
+ TEST_WB_UWB(100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100);
+#endif
+#if __BITINT_MAXWIDTH__ >= 513
+ TEST_WB_UWB(11110100111111011010100111011011111111000100101001001010110110011011010110001001000010111110011111001101101111111011110100111010000000110000000111100000101111001111010100100100010010011000011000111101101110011110111000111011001101101100110000011100110011101010011010110111011001010111011100100001100101000010010111001111100011101110001110010000111111010101011100100010011110000111010110101001001000001101001010000000010111100101001000001001101101000111011111100010110001111001110010111011000010010100101100111111);
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ TEST_WB_UWB(111101111000110101100011000011000111101010001001111001000111101010000100100111011101101101110010000010010001101111110100100010001000100001100100110111010101110101001001010000001010010010011100010110100111101100101001011111011101101000010100110000111111011101110100100001101001101111110000100101000010000100111011100100011010100000111010011011101110001011111001010110010010111011010001011001011101111000011011011101001000111001010111110011000011010101100111010011111100011011100001101101011011000111100111011001111010101010010110011010001111101100111101001110101100111110100011101001011110010111110100101111010110001110101101100100110100001000110100111001000100001010001101000100101110001001001110111110111011010101000011111011110000100111001110101100010001101100001010001000010000000100111001011010101111010111111111110100111100101110100101000100000111110001111100010010101101011010111001110011100000110001111010101011000110000010101001010100111010110000101000100100010010101100011100110110111001001100001101000001000001001010100110011111110010010110101010110101010110000000111000101100100100111001001010111111110110010011101000011010110001000000000101001000000000100111111001111101000011111110011000001000001111101101000100000111111100100001001101010000110111111001001010110010010011010011000010001000000011110001101111010101101111010000010100101011111111110101100100110110011101100010110001100110101001010100100011011000101010001111101010101000101100000010100000110111110110100010010110110101100000000010001000101010000000110000000101000010000101100010001010001010000001100001100110110000111001001111000100010000000010101010111000001101010110111010111100010001100001111001011011101001100101110110100100000010101000000100001110111000101000011011101000110100101111100111001111100010100010111110011110000000011011011100110110001111000011111011101101100000000101111101010001101010010100111001100001110100101101011111011000100110010000000110010000110100100100000111001111110100001010000101000010011111011001010110110111010100111100000001101011011100101101000000111000001111101110101000101111100100011010011101010101101011100101101001011010000010000100110101110101001010111100000010100001111101000010000000110011010011100100100110100101000111100110000111010101010000000110110010100000001001101110001100011001011010100100100100001111001011111111111110001001011010010110100100011110011101110100000010010101000011000001011101000000101101010001111100001000000000100101001101011011100101110101010000111110101011001001001001001010111000000100101101010011100011011110111100011100100010001010100011000010000000000110111010101111001010100110101010101000001000111111001111101111001011010010101000110000010000011010011100100001011011000010010101101011000010110100111001111111111110110111011011100000100011111001110111011011110101100011101110001001011111111111010001100110111001100111011100111100000101001001011111001010011110010110010010001100110001111110010100100110110011101000011011011101011011001000001111011000010110111111111000010110011000001101110111010111110100001000111101011110100001100110111000110101111000101101000110101100110000100111111011101001100101100100110011001010110001001111001011101001010101010111101101011100000100011100010001010000001100110110001100010001110001000110101101101010000001010101010100010010000111001011110101101100010110100110010010000111111100000011100000111010100000111011110111111000000100001110001011001011011000010110101110100011010000001110110101110010110001001011001000001101000111010101101101100111111010101010110100101011111001110000010010000111010100110000000100001110010000010010001000011100000010101000110001101111000110100110010000011001111001010000111001010011010111111110100111011011010101011011100110111010100100011010100011101111000110101010111111100101101110001110101101001010101010011011101100111111110010110011001001110000110011110011111001011000001011000110011100100000010001100111100110111010000101101001100011110001010010110000110110000000100001101011000000110000100000001110010010011110111100010100010100001100011001010101010010110001001110000001111100010000010001111001101011010100101100000010000001100111010010101111000011111101100101011001000110100110011101000110001100100111011111000010101110110000000011101111110000000010101011000100110011101111000100000001110111001110111010001001000011111000111101000100111001001001111100001000011110110101000111101000100111011101011111101111000001001001101100011110000111011100011011010111001100011111101101010001101001011100110101000101100001101100011101011011001110110010101101010010011100011101101011110001010100010011001010100110010111100111100000101100110110111010101001100111110101010100001001110010111111011100011110110000110010101001011000101110000100000111101010111101000110100010100010110011101001010000110110111111101111000110000111100100111100111000100110111011000100100011111100001101000110000011000111001001101110011010001011001000110101111100011010011010111011100011111000101111000101000100101011011001111101011011111111100101000111000111110110011100111110001000010001100110010111001101011100010011001100100010101101110000011100010011010110101010110101010001100001110111110111100011100000000100100010100010001011100100111010000111000001111001101101100100010110011011010011101010101010011011001011011110110111100010010110011010101110111101001011100111100110111101111001100001011110011110111101111100001110011111111101011100101010110100000000001111101010010101000000000100100001011110010001010110011010011011000101010000001010111100111100100010110100001001101111100110011111001001101100011011010110110110111001111011010010001011101101110111011010010100001011100111001111011000000110100011100010110010100110110011010011111010100011011110111111001101010100110010110111011011000111110011101001111010011111111100101000001000100101010101001101011101000100011000110011101111111101010001011001110010000001111000011001011000011100100001010110110010101111011011111101010011110110111000011111111001101100001000011100101010111001100110101011001100100001111111110111011001100100101101001001001000100000111000011010010000000111111011010010011011101101110100110110000001100001001101100110001101010011101100110001011110011111110101001111001100111010101011111111001100101110011000110101100000100111011110100000001000111100100011001010110000011111001010100001011110011100100111000010001010000111101011010110100100001110010000011101001101011001110000100001010101000010101011110110011000111001111011000111011011111000000101010101111001101110101001000011100111010110001010010011110010101010011110111001011011001101010100001001000010111100100110000100101100000000010110011011100100110000000000000100001101011000011011110101111011101101111010100110001101010010011010101100100100101001111000001011110111001100001010010110001000100010000011000011101011100001111001011010010010111001111011000001000010010010101010000011010001100101110001010011111101100101100111100010000110111101100001111100100010011110110010001111101111010101111100101001110000001111101101001110111011011010100001111010011101010110110000110000101011011110111010101101001111111101011011010100011011010111110110010011010011100000010101100010000000011100110010001100000111001000111100100100100011110110101100100011001111111000010011000001000111001100010111000010100011001111111110101000010100100010100011110100111001001010001110111111101111010111111011000101100101001010000110101011101000100001000000110110001100010111001110101110000000111010101000000010010011000100101001001100100000101011010001110101011111111110101100010100110110110111011101010011011110000011001111110000010001100100100101100001110100110100000001000011001000110011111111110101010100011100100111101010010000101101001111101001010101010010000010101101001110111110101001101110111101110111001100111011000001101010010011001100100101110010111101001010010101001011011011001011000011110011110000000000101100011010001101010100010000001011101011010101000101010101010011010111001110011100010010000001011011100011110010000101000101010011100000101001101101110100100010010000000101000000000011111110001100110110100000001101000110001010011110000100100110001101000110000011111101010110100101000110011011111010011100111101101100101101010000010101010010010001110110100010000101001010011011100001011011110101000001101111011011110011100101111101100100010100100010000101110100000111110010000010001001110111101100100101011111010110011001110000101010000010111010100110110011010010100110011111011010001110000100011001110111000101000111010011001101100010010010110001001110101000011101010111001110111100101101110100010010010010001011110001110001010110101100101011000000001011100101000101101111001000110010001111111110110100100100100110011100101111101000110011110101010000000111101010100001110011111110110110100100111110101011010001010000100100001110111010001001110111011010111111011100001000001110100111111111010011100101010011000101110000000111100101001100110001101100110010010001000001111010000110101001011011101100101010010011111010000110010100010111011100000000011111100010010000011000110100010101011111000000110111010101001111010101111001110001011101000010110101100111000011001000011011000101011001110101000010011010001000110011011100101110000010100111111001101110001010101111110101111111001000001011001010100011010111100001000011010010101110111001001111110111001001000010111001110001101111011010011011110100001111010000101110101101101111110001010010101110101000000011001011011001110010100010111001001011111111001100001010011000100011011101110001011010110100001100110111001111001101011001011101100000011100110101011000111100100001111100101111111010100001010011010001100110110000010101010110101101100100000101000101010101001011110010010100100100110001111100001110011111101110110001000100101010100010111011111101000100010110111001100001000111100000100001001001101111010000111111110001011111110100001101110111101101011000000011111000011111110011100010111111010110111010001001101101101110011010110001000101010101111000101001010100011100001110100111001110101000111101100000001000101000001111100011100100001110001101001111000010011011110011111101000101111101000110011011111010000001010001001100010000000101110100001111100111001011000101101101000111110100111010001011110101000000111001100010010001100111011100100001000001101011000100010100010100000101001101000110011101011110101010110000100011101101111000110111000100101110001011100100001110101011000001111111101011000110100000001001000000111001101011001001011010010001100011010100000110101110111011110111110110100000010111111001000001011010001001000011111111101110010000110000000111110100100110010100101110011100101000010011001001001101101110110011110001100000100011110110110001111111100111011101000100011111101011110001010101001011010111000110011110110101000111001010111100111011101010000000110111101110001110001011001000110001011010111100100100100101000000100000101111101111111101001011010111110100010100001011111000011000010101000111111110001111100010011101000001100011110111110100000011010110001001111100001100001001100000111010100010010101110101001100011101100000111011010111011110110010110010111100100111001100001000111100110001101100000011001101101101110010110101000111111111110100110010000100000100010100000111011001000110011011000101101010001100111001010010011011111001100011101001001111001010111010111001111101010000110010110110101000010010001010110000111100010000010000100100101000100110110100110110101100001111101000101011100101101100111000011010110111110100011100101111010101110101100100110000010110001000001010110111001100001101110010000111001000100100101101101110110100010011100010001011010111111001001011001000110111101110101011001110001110001101101010111110101110110001101100011111001010110001010001000100110101010010000110101010110011111010111000010101101111011100000011011110111111110011011100001110110010011101101100101111101101000001000110011100100000100111100001101110100001101000101001111001100011110110111010111001100111111101111101011001010011010110100010111110011010001000110011011011000100111010001010110100010100001111000011100001001010101110110101110010100000100111101110101101110100011110100100101101001010000010101000000010111101011100110101111000011001100101110111100101100101111100110001001000100101010001011110101111011100110110001111001011100111111111010100010000100100000011010110000011100111110101001111001000111100000010000100100100101101001110101111011000101101010111100010000001101100100111100100000001100000111111110110101111111101011100100111100000101000100010001010001101010010110011101100000101001111011011010001110010011010110100000000110001100000110001100001010111001101100011000000101101100011011111100110100010000101011000001101010100001110000101110011010100000110101100111101100000000011000100000011101000011000110111010110010010000111111110111110100100101110111100101100101001100111001101000100101001001000000000000111101001011000010100111111000100110001110000101000101010001111001110011000111011010110101110010000100100100110101100010001000011001101111001001110011111111001010100110101010001111101011111100000011110111111111000011111000000111101100001111000001100011100010011010110001111011000000011001100111001011101011000011111010101101001111110000010100000010010000100110011101011101111110100101100111011111011010111000001001001100111111101011111000000100111101010001000011101010100001110110100111101100011111001110000111001011011011010111100110111110101011010011000000010010110100000110101101111000010000101001010010000010111010101011010110011110110101111111011110010010011110111001000111101000001001100111111101101011111010001111100100111110110110001001010001001100010011010000101010001010011111000100001000111100001000011010011000111101011111101000001011100011000101011010011101001001001010001011011001110011111010110010000110101001011000100010110011000101110011111111100100001011110110001001011101010101011100100101111100011011110111010010101110011000101111110000110111111010110011110000011101101001010011111101110010101110100110001101010000111100111101100111101100000010010110101100110000000011110111101001000011011010110101110110000011100100111000111001000011100001100010010000001010001111101000011101000010010000100011000111011110100111000101110111000011000100001001101101010010100011001001110000000000001110010010110111111101110001000001101011001101010001100110101100001100100010101001100100100010011001101101100101111111010000101111100010001000001101110111000100011100010101110111000111011100111010011101010011011101111000011001000101011001101010001000100110010111010110000000000010000000000001110110101101011111110011000010111010001100001101101101010101001000000110011100010011100010110000010011001100010101000000011111001011111000001101111110000110100011011001111111110011110001011111100010010101001111100110011101011111000101111000110010110101100000000111000100010001100111110110001110100110101011001101000001110101000100010101110110011011100101101110010001101111111111110111100101011100000000110000110000111010011110110100000100001001111110101000011101011001000001001111100100111010111111111100001111110100100101111010101011010100111000000110100111001101001110000100001101000011110110010110111000111010100110010101001101011000011100000001001100110000011000000011111000011001110111100001110100110100010010011111111101100111011100000000111000010000101000111001111110001101010000011100110111010110001100000000001101010011001000111011001100010011011110111100111111111111001000011101100011111111001000001101011101101110100111101101001100111111100010111110000000010000110010100101001000100001001011000111101111100111000111011010010000001001011111101100101010011010110000111111001010100101000101010110001011000101001111111101001000000101110011101011101100000001100110000010010101111000111011010111011111110000100011110111101001110001010010110101101000011001101110001100000001111101110011101110100100001000110111110010111100011111001011000000011011010101110100100111111110100111001001000011000001111110001000111111111110010110110010101111001011111110001110101000001100000110101000011010011110100000000010111101000001001010001101011100001011001111101101010101011100100100001100011011111100110010100100010101110110100100101111000011010000010010101010110110011011110111101011011100010111110010100100110101111001000101101001000101111010111001110011011110110100100001001001001000010111010011001001000100001100111111111101100100110110110001011101111101100011100101100110100111101100110100111010001110001101000001011001111000100101100100001011000110001111101000111110101111101110110001110000011100011110011011111101011010000101101011101000000110010011010001110110010101010010010000001001000101011111011111101010000010011001101100111101100110100100000101000000101011010110011110111100111010000010001011101110111111001100010110100110010000100001111011111110010010111101011010101100111000010101011010000110010001111101111101000010010001101110101001101010101001000000100100000110011100001101111001010000101111010001101001100001101101011100101111011000001111101110100101000101011000000000010110100111111101101001110111101100000000100011100101101111101111110010000101011100010101101010100111011111100110100100001001110100010001111011111100111010000111110001001010111110011101011011011110110000001000000111010110101100001111101100011101001111101101100011111000101111011011011110011100100010000101000010110110101110000101100100000011110100000110110010010010110001011000110110101111110010100101111101110110101111001011010110011101010100101110011111000110001011011011100000010110110100000011010010101010000000000101100000010010110011110011110000100101011011100100010001010000100000110011010111111010000011001000101011011110001010110001101100010000100100011101101101100000101011001000101001010100010111010011111011101000110111011110000000110011001111000111000010111111000100101110101000001011001001010000000001100100010101001010101111000111111000110010110100110100110111111010100001010010111110111110011111010111111111100010110000001110011110011111100011001001011110101100000011111101011000011111011001101110101001011010001010000001000011111100110011110111110101100001111011111100011100111001001111101100110001100011011111010011011101110111011011000001010000101010011110010010110000100010011100110011000000110100011010000101100111001011010110011000100111011110101001111000111110001100110101000011000001101011110011010101011001010111010100000110001011010110010000001110101011111101101111101001010000000001100000010000000100000011110001001001010110010111000011011011010011001010001001001101010001010010001101011000101101011111101000000010100101111110011111011111010101000110011101001011010011010110101110101101011011101010011110111011011101110111000010100011011101010111010001001101111111000011101000110101000000110001000010000110011011011100010101000100101110100010000100001001101101001110011101100011010110000011011001011101111100101011110000001110111011100111010011110001011110001101000110000110101011101100000011101100011100010011010001110010000011100111011111000001011111000100011101011000101111110011000000000100110100010000101111001001011110001100111110000110101001111001010000001010000100000110010000101111100101000110111000111111101110001101111000111000001011010000101101011001101111110101010111100000011000010011100010010011011010011001000111101000001001111000001110011110100111010011000100110101100000110001110111111000101111001010111110001000101101110011100111011010010011111010010001100101011010011001010100011000101101101010001111010001110001110000100011010000100001101001110011011101100111110010101000000101010101000010001110100100100111010000011001100101000011010100000100100101001000100100001101111101111000000101000100001101011110010110010101010100110010101101000111000010001000101111111000001010001111010011111011000101110010000010011001000110111000100010000110000010111001110000101111001011011000001001010000010001000100100001010001001100010110101001101101101010001100000101010000001011011011001100011100111010000000011100111010101010111010001001110011000000011001010111000110000100010100001111101011101000110000110011110101110101010110111010001011001011111001010110111110100011000010001110110101011110101100111100001011001011110000010010110111011100100001110000011110100011100100000010111100111101000001110010000011001010010011011010100100110101011101000010001101110100000101001101101000001111010011011110010100000101001010000101000000110010110110100000010110100101011000011010001100011001010100001110000010111110111000010101100010110011010101010101010001111010001010100100001010010010111011010011111111011000010100001010101101010100010001111101000010110010010000100100100000010011101000011101001000010011010010101001111101110100100001100001011010011100010110110111011110010101001110001010010011000111000011101000101000010110111101011001001100111111011010001111111100000111111001101111000000010011100100111010001101111010101100111001010011000001100001101001000100001010111100100000011110010100010010111011100111100000100001101011010101100011110001011110001110111001000111000111001111111001011011110010011110001001110101101011110011000010110110101100100110001001101111101011101110100101011101010000111011000101000100010010010000101100000011110011000000010000100100010001011001111011001110100000101001000100110010111111000110000100000011111000000010111010110101100111001111110000000000010100001111100000100100011011100011011111101000010111101011111001011010110111111010001101110100110011001011100011011001110111110100011001101010011001010010011111000110111010001100100101000011110001110111110000101110011101001101110111011001000010010111101011001010100101001011110000110101001001111111001110111100011010101101110101110001001001001100001011110100010010011000011110101000000110011010001111001000010010101010111001001111101110011000111000011111100000010110001011110100100100110110001110110100101011101001010000001011011000101001000001011110111000011001000011110101010110011100101010110101000001010111100010000000011001010101010010111000100011110111100001010000110001010111000101100001111110000100000101101001110000100010110111000111101110100100111110000110010111110000101111000011111111011000100111001111001100111001110111011011110101010100101110101010100010001011111101101111010011110001011010001110011011110001001010001101100011111000001001000111010100100001100111010010010001110010101010100001101101011101111010111110110100010100110100100011001100110110000001000011011101100111110010110110110101101100000010101100001000001001110010111110100011011000000000010011000010111011111100101000110101000110001101111111101101101100101101001101100011000111011011000010110100101101111111110010111100100011101001101101001011111110101010100111111101100000011001011101010010001011011100111000100011001110111010110111010110010001000100110001010010100000101001001000111011010011000010100111100001100100110011111011100100000111010001100110000010111101010101000101111110000000100110100111010011111101011000100101110000011100010001110000011001100101010000011011001101001101000111100100111001100101010110001111100010100110110000110110001101100000111110101001101100011001110000010001101000000101100011101110000011111101110011010101011010010011011001001101001110010001110010010000011110101110001011111011001000011001000111100011001000100001100110010011010100101000001111001011001110101011101000100101111111000011110111001000001011111100010111101100000110111011100011011110110110010100010111110100110100100000110100111100011101111110011101101001100111011010101010100011101000000111011101010101001010000100010100100101011011001010110100100010110000111101101110001001111101101100101101011111101011010001111001101011110000111110110110101101101111111110011000011101000100001110010011001000010101111101111011000001101011111101011000011011111000010111110000111110110100000111100001011011101101101110100111111010000110011100011001001101110100111000010110001011010010101000010000110100100110101100100111000100010001111111001000010110000011111001110000011110000100110000110100110011110100100101011100000010001011011000011010001110000101010100001001010010110000110001100111011001101111001001111010101011101100000001111101110010111011000001011011111101000010110110001001011100000011011000100111110110110101100110100101111001001110001011101111001111001110000100101000010101100100101011101101101110010101111100001010011011001100001111100010110101101110100001100110110100100010000011100001001110110110001010010011100011111101000000010101010111110011100000011000111000111101010100111111100000110101000001101001010000100110100100111110001110000010010110011011011100000110111100100000101100111011101000011111111010011001011001010001111010100011001110011100000011010100110101010110100010100110110101101100011001100110100011000110100011110001011101100111010010001001101001101001010101101101000100001110011101001111101111000100101110100000110110101101101101001011111100110010001011110111111101100101111000010111001101001101110011010111100010000111111100100001110111100011011100101101101000011000000110101110000000000110001110101111011100010101011110100001100100011011101000001101111111000000110101010101011001110001101101110011101000101110100100010100100001110100100011111011110110111010010101011000100000101011100011111110000011110000111000011110101000100010111001011011100010010001100100001100000000000110111000101001100101100011011110111111110110100011000011010101110110101100010010011011101010010000001011111011001000001000000001101101011000111101010011101000001010100000011011001101101101100100100011001011010010111000111011110001111010101101100111000010011101101010001110001111000000011011011001110010111100001101111010101110111100001110110001010011100001101100010101010111011011011101100010110010110011100111001011100001100100101100111010001000000100100011011011100111000101101100101001110010111011101101101110011110111101011000101000101101110110100010111011000000010101100010011000001110000010101100100001001000110000000001101000110000001110001100010000111111100111110010011010000101011011110011100001110101110101001011100011110011000000110101100010001010001011010000001001001000111001000000100100001001001010001000101011100010100110101101110111011110010011100111101000011011110110011110000010100101111110111000000001011110110100111011010011110011000010001111001011110001100000010011111101100110011010110011001001001110101101011100110111100011101111110110010101100011000100000010010001000010111000001100100100011000001011000110110111101100001000101101010000010111110010110001110010011011110011110000110111101110100111100001001001110101110111010000110000101001100110111000000001110110100000110110011110100011111111110000010001101010101001000001110101111101001000100101111011011001111100110110111001111100100001100000010010000101011011101001100111100110011111000000101010110010100011100010110001010100111100001101011010100110111001000011110010101000010000110001111101110111000101111101110111101101000001011110010011001111100110111010001111001001100000011110010000010111100110010100001000110001000010101101110001100001101101111100011101001001001101110101100110001100100100100001111110100010110001110010001110000011001001101111110100100101011010101110000011000000010110110110010101010011001001011000001111100101011010101110111011010011101110111011111111101101111111010111100101000000111111010001101011011000000101101110100110010011101001001101010010100111101110010100110100101010010011110111111010101101101110011111000011101110110010111101011001101001000111101011010000110110010000111111000010111000101110110001101000100011010111011101000000001000100000011101011110100100010110001110011100111111101110011010010110000000010111010000000100100110010100010011011111111000011011100011000001100001110000101100000011000010000101110100110111000110000000011100011110000100001101101011001011100011110100000000000101000010010001100011001000010111111011110111001011001100011001001010000010001000111011100010111001000100101111111010100000110001010101011110000110110111001001111110110000111011010011000100010001010011010000101101000110011101100101111001101101000001010111101111011101010111000111100100100111001001000101011001111101000110101001101000110100001011111010001001011010001000000111110001010111101100110101001001110110000001000010101101111111100011111111010011011010111001110001010101011111110000100111001100000111110110000101001001000000110111100101001001001100001110001111101110001101011010010000111000010011011100001110101010001001000010110110101100101001110011110000010111111100010000110111010101100001001110110010101111101101101000010110001110010000000001000000000101001100111001000010001000101010011001000000000011000111100111100110101101100101000110111000000010000010000011110111011100010000100001111001100101001101011001101000101001001000011000001100010001011100010000100111100001100011101100101011101011111101000011010001011111000111111001110000011110100100011000111110011110111001100010000010010001011001000010101010111000101011101100010101001101110000000001010000010000101110000001100110011101101101110000111101100001010001011101000111101011100011100000101000010100001110011110001100011110011110100000001000010111000101000111000100010010110101100110010100011000011000101000010001010100101000001101110001000100110001010111011110000000100101100011010101010110101111111110001101001001001010100110111110010100100001111001010010111010101000110110100101101100010110010000001000000110010111100010011101010000101101000111001100001000001100011100001111100010001101111100111111011101101010101101011010000100000011101011010101011000010011010001000011111110101000011100000000111101010000100011101110001100011100100010011111111100111100000001010000011000110110010101010010010111000000111110111101011000011110011100010010010111001001011001101001010101110110000100010010110001000100100101011010011110000001100111110110000011010111110011110111111100111111110000000101001110110010010010100111001111110011101000111101010100010001010001110000010110100110110010010110001011000001000100010101110000100000100011010011011111111011001101110100100001111101110011011110010110101010001001010000110111010111011000111111100010000101101100100111011100111100110010010111001101000011101100010100001011010100011010010100101101001010101101111000110011110111110010101111111000001001000010010011101100101000110101111110010011111100100111100111000011111000000011100100101000100111011100000010001101001000111010010100011101010001001100100100001011001001001110011100000111111000111010011011010000011001111010000100010100000111000101000011011000111000010100010010001101010100010100000101001011011010101101100101110001110001000101110001111000001011011000111110010000100100101000111100111101100010110000000010110010110000000010001111010101001110011010010011110011110010111001000000000000100101010000110000000110100011110011011110000000010100001101000100011101100000100000010111101011111100001011101110101001000011000000101101100101010000100111001111001101100101110011110011000100011011001100101001110101100110000111010011011110000010101100101010110101101110100011011110111100010100000010100011110100101101000100101011011010001011110001111100101010000011001010010010001111010011100100110110000011001000101010001101101111100100000111101011000111001001111100100110111001101100110110011110011001111110011111000010001100000001100111001000010111100101101100110011001000101100001100101101100001110011100111000000111011100110010001001010110000101111110100001101101111111111100101011001101101010111101110000101111010101101011011110111001110011110010100000100110111110110101111011001111111000011110101100111010000010000101001000101010000100010101100100101011101110100000100011101110111110101000001011101101101110100110110101000100001110110101111011001001001001001100010111010100110001110000111111111000110000100011011011100000100111111000110001001101001000010111110001111001100101001100100111100000101110111101010111011000000101011101100101101100000010011010110000010001000111010001100101111000000111011101000111100011100001100101001000111111000100110010010111111010000011110000001110011111111111111011100100001001110010101110111111101001001010100100001001111000101011111111101011101000000101011011011011110111011111111011010110101001011001110001011001011001101101001010011001001100101011000011111111000011011011101101110100111111011011111100011100001110111001001010010100101011001100000010011000101111000010000001100101101101001001101001010010010101111011000110010100100010111011011000000000111000101101011110001000011001011011010001110111001010101110100001001110010011010010000100111000101110110000111010010011110010100011111001001101100110010100111111000101001011001101101011100101111011100011110110111011010111001110011110000011111001000010011110011111100000100110100011010011010110111110100000111010001111101000111010110111111101110001000110100011010011111101100101110001100110100101101000110110011111010001111101100000100010011000001001000000110011110000010110000000110111001001111000011110010100101010110111100111001000101100101000110100111010110101011000110010010100001101111011111010001111100010101100000001011101111001100001100000010010001111010100101100001110101100010000001010111010101011111101110110000000001011110011010000110101111101000101000111010010001011010010011110000001110101100011011010101001110001000001100001110100010011000101110010100010110100100100111001100001000001011011110111101100110001010111101011000000010011001001110000100000011101011011110111001110101111111101111001100000101100001010000110011000000001100000100011111101110101000100001101011111111101010111110111011100011000110100000011010110110110111001101001110100011101000001100101110010010011101010000101100000001110110001011100101000110010000110111001000011001100011101011110011000111110110010000100100000100110110101100110111001001001100111001001101011001010010010111011111000100011100100100100010101100000010010100100011010010110010000111111010100110110010001100111101010100101101011100100011000111001001111111000011101001110100000101011111111100101100011100001000000111100110001001111001101110101001000000000110010100010000001001100111101100100110011001110000110000100101000010100010111001110011001101101100011110100011101010111111011110100010011001111110001000010111001001110000001100110111000001101010010000101111011111011110011001000101100011101100001000010101110000001111111001010011000101010100101100000010000000111001110000110000010111000011110010101001110010100100001101010011001001010101010001000110111011110101111100000111000000100101010011000111101110111111010100011001000010101010011010010111011011111111000100100111000100000011011001100111000000110011000100111111011101110001010000010011010000011101111000100100000100001111001001000101011000001000111001101110110101100100100100101111001000011010011101011011001010000001110011101010101011110101001011101001010111000111111101001000101100010101110010011111100000011100111001001000110010111011010000000000011101111000110101111010100101110010000011111101001100010100110110100010111011100100010100011110111011101000101000010100001001000100110010011100100100100010010010101100010111010110001101011011100111000101011100011010001010101001111001001010011000011010100010011111101011110001010011101100100010010101100011101011010010111001010100101000100001101011101110111011100100101010011110100101010100010100001000000011110100011111110011111001001011011011001100101100111010101001000000100011001110011110011001001111100101101010110001111011101011110110001111111101011011101111001110110001000101111010010101011010111100010011001001000000110110011110010010011000101100111010001001001111110100010100001000101001001001001111010001111101000110110001010000010100000111001001001110011001110101001101001101100101110100000100010000001110011111000101011001111110111110100110100100010001010111110101011110101110011110000000011001100001000101000001100110011011000001111010111011000110000010011111111110100011011000101111001011110010011100111000100001010010101111111111011101000011010000111101010100101110100111010001110110011100101010100010000000011110100011111111000111010101000001110110010001101101100001110100011001010111101110011101011100010000110001000000001101110001100101100101011110100100100111101000000101000001001110000011111100100101110101101101101100100110100000111001011110100111111000100100101001100100110111011011100101101110001001101101110011101011000111010110011010111001101000100101010110010001101100000111010000111101011111001111000000101000101111001011100101101101111011110101100111000000111000100111001100101101010100010111001100110000111010101010101001010100100111001111011110001110010101011100101010000011101100001101001111001000111000001011011111010110111001011000110110110111001000111010100000110110110010001110110000110010110010111101001010010000110101101000010110101000000001010101101001100001110010010100001101010111001101110110111110101110001111000111001100001000001101011101111110111001010011000100100111010011001000011011011000001010110111000000000001110000000101110010110100110010101101111011110011001011011000001000101001100010011110011001100110111001010111000000100111101001010111001000110111110100100101011101010000110110111010101001101000101101101000010001101101111100101001011100100010011101101111110111101001111000000011000100001010011100000111011100000110001110111100110000110100011101011001100111000101100010101110111001010010111001110101100111000011011111111010100001010111111001001100110010111010001111101110011001100000110000110101000011000111001011111110011001110010011001010101011100110010110011100110010001111111001101000010110101101100001001010100110111001110111100000110111111001010111101110010110101111011010010101000010111010111000100110000011110010010101001001011111111010000010110111110001111100111110101011100100000110011011101011101011001100110101100000000001010011001110001100010000100010001001011010100001010010010110001010011011111010011110001010100000010111000101010011010100111110101000011011101110100100010000111110101111010110110001110011001001000111011111101000101110011000110111000000001101001101111101000100100100011110111111000001001100010011001010011001101100111000110011111110010001101010001001001011010000000100010110101000000110110101010011100110000100101100011100111111100010000000100010001101110001101110001101011111110110001011110001101000100000101000110100011011011011010110101111101100011010100011100111011100011111010001010100000001100000000001100110001000111001111101011010100010000101000110111110001111010100011000001111011010001101001011001010000001100110100110111101000011000011011001100011011111101111100111110100111010011101111111100000010110010100000011010011101010110110111110010011101101100001101110100010100000100101010111011001010010111100011010100000011011110010010000101010111111100100110010110011101101100111100011110111111110000110101010110011010011111111110100001111101101011101010010011011110011110001000101000111011000100010010011011000101111000001010110001110011101110100000100001101001011000101001100010100010000011011010010001110110101011110101000001010010001000001001111100010110110101101101010111001010001110011011000111010000001010111111010010011101000001110001000010001011111010011011011101000010111010101101100100011100000110110001011010100100010111000101100110011101110101110101010100100100100011000010010101101001100000001111100101101000111010100110101110111011001101001011110010101100100001111001101010010001110111101111011100010110111101110011111010000001000111100001100100111111001100010000011110010101110011010100000101011001001001010110100111110010000000110010101110111110100110100100110011010110111010010001100001010110111101000101101001010000010001000101111011110011111100101001010111110001101011111101100101110000101111000110101011101101111111110011101010010100011100000100011000001000101001000011100000001110100000000010111100111111000101010100011010010111101111011101100101101011010001111011011010011010010010110110100001000011101011100100011000010000000111100011101010010111111010110110011100100111001100011000001000001101100111000101101111100110010000111011011101010111010110000001011001001001001010110111100010101101001000011000011000111010110000110101100111011010100110010010000101001101011011110010001110000011011110111001000110010011110010111101101011100010010001111100001010101000101101001000110010100101111010100100000000101111111010110101100110010011010111101111100110101011100100111111110110001011011011101001011001011011100010001110000111000101101100001101001111110100101110101001010110001101101111001010010000001011011100110000100111101100100111000101111011011101101001101110010001001011011011010101011100110000101111011100000111111110011010101101001011101110110011001111011001001110010110001101101010010101000010011011111010011100101010101111010011110000101011001101001101001100101011001100011011010011111111010010010101110011101001011000000010100100100010000001111111011010111011101101000111110100110001011001000101001110000101111000010011000100000110101010110100100110101101101011001010100100100010000111100010011010110111111001100010110000000110101110010011111000010101100001001101001100010100101101101010010101110110001100011001101001111111111001111001000011011001101011000110101111101000100110101110001000110100100000101101110011010101011110110001111011100000001010000000011100100110100101000000010001101000001100110001110010100111101010110111101111111100110100101101001111010011010011011011100100011101010111101010101110010001000101110100001000101111010010111110111111100110010000110101100010111111001000000010010000101010011101000101110101111001100101010110010101010101010110000000110111100011101110010001010110100011000110111110111000011000100100011010010100100011011110100011010100101010001000011011010011101001001000000011110001001001011000000101101110101100000011111001101111111010011001011011001110111111110001011100001101110010111101011110001000010100110010011010010110000011001100000011100000110111110110110111100010100110000011111100001011110010001011011001000101111110001010110010010101011010000101111001001101001011011111000001100111010010010111010110100111111101000010000000110101010100000011000111100011100000001000101101111101001101010100010000110100000010110111011101011011110000111010101001101101110001111111001111100110010000001011010011001100000010001010110111111001011111010110111011001101111100110111100011100000011001111000101111011000101011011000110000101001101000000100100001111111110000100100111011001001010000010000011011011010100011110001011101010001001111111101110110010010001000111111000001111101101011100001110010010010011110111110011101000100000100001000000111111111110100110001001110100010011001101111111110111111101110111110010011011001011011010111101100100001011111000111110100001110101000110010110111000110101100001100001011101000010000101011000100001100010010100011010111110100110011101010110110101001011010010001100110001011101110010010000111011011100011011001101011011010010010110100110100010100001100111111010111100000111110111010000111001100010000011001101110110000101101000110110101011101101101101010100001110110101001111101110011000101101001100010111100110100111000110100010101001010000011000110011011001010110001110110111000100010010111000000110100000110110100000110101000001001110110110010010110110111101011001001110000111110110001100011101100001100111100001001100011010100001000111111010101001001000001000110011101011110010000100100101001100111100110110001110001100101000010100000000100011001110010100110011111100101101000101111111010000001001100001000000001011101111111110010101011110000001011001000011011001101010010110101101000110100011001111101101001111010111010000100000000101101001101010001000001010011111001110100011111111110000000001111111001111100100111100111001001100111101000010000010001001010100010011100000000110111000100101111010000001000001111011000000000110010111010000110111001110111010000010010101100011110011110010100100111000111001001000000101101101110010100010111110011110011101010010111100000000110011100111011011101000000111110010111001111101111101011101010011000010111010111000111000101100011100101000000111010010001111011101100111001011010110011101110000001110001101110011010000000100100101111001011110110011000100010111010110010010001000010011111011001011011110011010001001000101110110111001011011110111010010000010110111011001011101101111111100101010110010101100110000010001010110101011010100011001101110000101100001101000000001011101101111101101011101110001111010111000001000011001101111110000000001111011010010101110111000110000111000000010011011000101000101100100010010111011010100111010011000010000010110010101001101100100101010001100110011011111010001001101100110010001001001110000010001111010111011001110001111010110111111010011111100100010001011010101000111111111111100101111010000101101100000000000100110110000110001100110011100011101101011011100100111101111000110110101011001000001000000101111111010101101111110100101110110100011110111101100010010111001011001010000000111001110111100110100111010001001100001001100000010010110000110111111100000101001001101101110000010110011111010110011001001000110010101000101110010110011110001011010001100100100001110110100010011101011110001111101011010000100100101111010010001001110100011011101001011010010110100011101010001100111011011101010011010001011111000010010111111101010110110001101110010100110001001011011101111101001001010010010100101100001100101100010001000011100000010000010011100001000001010000100010101101111011100011111000111100100001111110101110100110101110000011111100010100111100111010100111011000100100000100011111100010011000111101100000110011111011011011100010101111101011000010111000110010111011101111000110010100101111000001001011101110000000011000111101000111001110101011110010010110000111101001101010101100010111001001111010000100111101000000010010100100101101000110110000000110011001101000111011101010011100100001110011100110111001110100000101010111011100111100111010100101101000011001100100111100001101011001111000010110001100100101111111111100011101010010010101010010100100110111010100001110001101100101000010000111010100001000010100011001101000011000111010110111100001001001001110001000001101110010101100011110000101100001011111000001110011000001000101001001101111111110001111000010010110101010110010010011100111110011111101010010110000110000000100100111001111110010011111000111101000111101001101000100010111010111010001100000110110010011001000010101110011100010010011111011001100000000111100010010000100000110001010111101001000000110110001100011111000010101100100110011011001000010001000011000010000010011101001011101000100110111000100010100000011011100111110101011011101111101101001010100100111101111111001101111100101010111110101001010001010011010110000011111100101101111011001001000001101011000001011101101010100010010100011101111100101110111100001101011101001000101010000001111100010110101001100000110101110010101110011000010001101011011101011010011100100100100011010011001011101001000111011101010011000011100100001010101000010000010011100011111010100010110110101100101100001100100100110000110110101100111011000011000000000011011000110101111100011010101010101011110010100010111000111001101101000000010100110110011110010101110001011011010101000011011011101011111101110010110001101110110001001111110101000101011010100000101100111000011010100000100110010110111011000010010110010010101010101110000000110010010011010010110110100110101000001000111010110011010011100101001001001001001100110011111000011100011010010100101010110000101110001110111110001000111010011111111111010000111111001011101110001101010001110011110011110101111100000000010001000010010001100000111100001011101111010100100011100000011100001110101110011110011010101100011110000001001101101111000001000100100101000110001001100000010111111111001010011010101010011011000001010000000010110111110000100100010110001010100000101010101000110110110100110001101101010100011101011111111100111110110110111001111111110111110101100010010101100000101101101011100110000011011100000111100011011011110101011011110011111001101011100001011111101000010000100100101000110110101110011010110000101010110001101011101111101000110011010100110111110101110001111000011100100000001011111111101011111100111000110111101001001101100010001010001011111000111000101111111001010110000010011011000011000011110010100110100000001101111011001101001111100001011011001001111101010110110111010110001000000011010010100010010100101100111110000011000011110110011011011011001100101100101010000011010100110101100101010100001000010010101011001100110110011000001101011010001000010001110001100111000100001011000100011010111011111111111100110000001010001001110010010000100101111001010110110011101011100111001011101001111110101110101111000001111001011101010101101001111001111111001010100011010101101111000001011000101100100100010010001111011000010010110111001000110001011111010100010111111011101001010111010111100001111011101101011010100011001101110111101110111011100000100010111100100100110010010010000010010111011000111100101000010000011110101101100000001110011111110100100000100110001100010010110011011000110010110001111100001001110011110010010110111010010110001100000010100101011010000101111001010110011111110001001000001011110111010110000111011110000000111101011100000011011001100101111000110110010011001100101100101000000011001001110010001011100111101010000000010011011110101111101101110011101111000001011011001011010101010000011001011000100000111100111101000001100101011010001111000001100111011101010111010110011000110000001011000101000000111001100010100101010011111010110110111010010111010110000100010000100000001011101000011110111011111010011111001000110101011001000011101000000000000101100011111101011111001111001000110010001000100011001011001001111001000011001110010011000010010000110010101000111011100001111110010000000001001101111110110010111010111011101111010110100111100011101001001000010100110100011000101010110001001111000100100000110000010010010011011100001111001101011011101000011111011111111000111100011100010000010001001110111000100000001011100110110101111000100011001110000000011111011001110110100100110111001110111011110011110110111110111101011000100001000000101110000101001011111000000111001000111111001010001100010100101011000011110011000011100000010100000010110010111101110001111001010001001111010011010000010011000001100101001100101001110001001110010101000011000110101100011100000111111110100101010001000010101101000001010011011010011101110110010011110011100101011000010011001011101001110111010110101001000100110100101100100110000000011111010111001010000101101110001101001000000100100101100111110000101111011011011010011001011000000011011100110111100010110100001110110010011110111010010111010011001100100010010000010101100100101100001011001110101011010001111010011100010010010010000011001010100000100000000010010000010101011010101010000100001000100000001110111100111101111011100110010110111110111110100010001010110011010100001011111010001011001100100011011111011111110011011111110001111001110111110101100110110000001100111001000101111000110101100111110011111100100110111010110101011011010100000010010100100111010101001000011001110100110111000001110110011001010100110100100001111111110011010111011000101000011110000010010101111100110110000101011001111110000000100000101011101011100101111000110011001010111011010100111101100101001111101011110010001001001111001101001111111000100111011110100010101010011110000010111000101001011110010000010000110101110001111001010101100101100011101010001001101101011010111111001111100011110011000000011001011111111111101100010001111100110011101010001100111000110100000011100110011110100100110010010100111010110001110111010011010101011101010000111011101100101101101001101101110010111111101010110101000111010010000001001000101000110011011001010110101101001010111111010010111010001111111101111010110110100101011100100010001111000001100110101011010100110010011110011011000110000110001100101110111110110000001101000011011111111001101010000011010110011100111001110001110001001101101001011111101110101110110011011110111101110011001001010010111010100101110110011110001010011010101101010001001101010000001110100100000101100001101011111011011001001111011110010011110000011110111111011101000010010100010010101011010110101010110101110110010011000100000110001111001001000011011111111101110011000000100100111000100011100000100000111010111100101001011100101000101011110001010001101001010011010011001100101100111010011110010100010010100110000001110111011011001010010001110000110111011100101001000010111010100011011110011100110011111001010100100111001111110100001010001010000001100111100011111101100011011000100101101000101011001101111111101110110111110110000111110011110110101101110101100100010001110110111000000111011010000111110100100111010000101001010010001111010001011111001001100010110101111101100001101100000000100001010111001000010000101100110000100001011010110101110101011111101001010001000000100001111101011011001100100011010110101011100011110011001001000000010101111011100101001101110111110101001100111010110110101110000100000010111011101111000000110011100011000011101110001100011001111001010101010010000001100101011111100011001010000100001010110110001011000101000111111110100110100110010110101001001011101010001001010010011110100011110100011100010011011001011010101010111010000011100110100100100001101110101011000011010110010100110001000001010110011101010100011011011010001010000001100100000101111111100010100110100011101111111100010110110110000100010001101100011000000001100001110011011010010111010101000100100010110000111000110010001011011101001011100111101100111101110110000010100110000010100000110110110010100000011011111100110111011111010110100110000110111101110011011010010010101100001011111100100111001100000101001010000100110101111011101110101101110100111101100000101000111110100100000001011001000010110010101101101000000000001001001110011111011011100111110001101101001100010110010110101010110010110101101001011001011011000010101001100110111000110010000110001000010000011011100101110111010101101000001110000001100000110001011011010101000110011010100101011111011110001011011001110110100000001001111010000010001011010000010101111111001000001011100000001010111010011010110011100111101000011010011010010000000001000001000111110011010111001101111111101101101000000110010111101001111001110111001101001110011100001101100111000100100001110011111010001111011100001100110011011100000111010110011101000101000001101010111110000001000110011001011010001111100010010001011011001001010001110011001010101100010000110001101001110011000100101100011000101110111000111011111011011111001010111110011101111100110101000110101100010011000011100100111000010111011011100100111101100101101100110000100110010110111010100001011110100011011110101111010111010011101000001101000110100110101001100111011010100001010011001111100110100011100010100101101110010101111011011001111001101001111000011110110101110100111101011010100100011111001011100011111100010101000010010111010000000110101100000001110111100101000000100101110111010011101111001101001100001001111110000001010001100010111100110010001000011001001011110101001000000100011010100010000011001111110111010011001110110011001011011010111111001111001111100000110101010010101001000011011001110111110110000101001100111100000111111011110000101110111010101100111101110110000101110111011100111010100000000001101000111011111010101110000001011110001001100100001000111010101110100001101101001110001110000001100100001101000001101100001111111001001000011011010110001110111101111111010101001100101011110111101101001000011101110110001111010001000110111000110000111001001000001110000011111011110000001110110000001110000100001000110011110010111010000110010010110110001010001001000010000010010111001001100100101011011110010111111111110110010110111111101010010011101000101110000000000111110110101011001110111111100110100010010011001100100100000101010010111001001110001001100010001010000011111010110011111100010000111000000001011111101101010110110100101110100000010011011100111010101100111011110010100111100111101100000010011100000111001000001011010011001111111111100010011011111101100001101000101100101111110001001100110011101011100010101111111111100001001000011000000110111101110011100110101110000111110101000111111001000111000100101011001101110100011100011111111000000000111000000001010000010000000001010010100100101101111000101000001110001110011000110111110101000001101011001000000010000010001001011010010110101011011100001100000101010001011011010011111001101101100100101110111001111000010000100110101010010110011000001000001011000000011100101000110001011010110011011010011101011101110110001000101100101110110010001111101011011101000010011010100111101011110010111100111000101010010000001000101010000100001110101000110110000011000101100111000000111100010110110101001010100000001111100111100101111000110011010100010001110010100000100010010010000011001001010011010111000011000101110011100001000001010111010010101000011110100011100101111100000110100110111111011000101110101000111111111010110001100110010101111110101100111010111010000100000011001101001011010110111010011111110110110000101001001000000000010001110010001111011111011000001110110110111110100110000111000001000110001001111100100010000010001111011110110111001000010010000010000000000101000101010001110011100100100111010111110010011000011101010110100100111000011110100110001111010000111110010100010001101000110010111000011110111101110111101001100101001000110010100000111101111001111100110101011000000110010100001010100100011101111000000111010100110011100100100111110110111100111011100111111001111111100000111000000010100111111000100100100010101011011111100100111111111001000101100110111100000111100110001100010010101101010000100001010000100001010100010101011111110110010011010100001010110010100110101110010000000001110101100000010111000100001110100000010011010010000011001001011110000010111101001100100100001110000011110011010011000011011101110011111100110101111100010101100100010010101110101000010101101101011000110111000110000011001000100110001000001000000101111000010111010100010101111000111000110000001000101010000011011111101011110000110101110011011111011101010111110101010101111001100011010111011100111011101110100001111010110111100100000011111011000011001110100000010101101101010011001111011000000010111100100110011100011010011111101100100111010100001000101000001101010011111100111110100010011101001110110001010110001110101000000100110011010010101011101110010101101001110010111010000010101001100101111101100111110111010010100011010011001101100111101100111111101100000111011010100101011101000001110011000000111000011111110000011011011101111010001101000100011010001011011111011101001011110101000010100000000001100000001000101000010110011011001101110010001011100011011101100110010100111100100110100000010001100101000100110100101011000100101001000111101100000100111010100011000110000001100110100111100111001110010110011011010100110110101111100100111011011000001001111000001101000001110110010010100001111011011001101101100001111110110111010110000101010010110010000001110111000010111010111000111111101011000110100000000111101111011100000100111111110011110100111101000010001000101001011000001011110011111110100110010001101110110110011100010000100111101011100111010001110110111000100000000111011001011101001110011010100011010100100001100101111100010111100000011001000011010101110111111000010100100101110000010111110000110110101000111111001010111100110011111011000011100111000011001100001010100111010000111101011100110000001100010110001110110110001100100101000011100111110100010010001001101111101010111110011101010001101011100011010100011100010110110111001001100111101010000100010110001100110010010101011100010001111001000010110100100111101011011010111011011100000111100011000101010010000111101100001010110100011010001000010011101111001101110001010010001110000100100001111101111011011100100111101110110100001011101110101111101011010100010010000001001011010000010101000110010011111000001110110001111100100010011000101011110110001100001000110100000101000000000001101001001110101010110111001101100011001111000100100001101001111011011010111000010011101011110011110010101010100000110010100000110100000010100100000110110100101010000001100011101010001000100011001011110010011011001100000110110000001001110101111111111011101001011110111100111110010111100001000010010001101100001110110111010100010001110100110100110100101101000101111100101101101111010000100100110010101001100110001101110000001100011111100010011110010101100100001110111111011100100110010100011011000101110011010000011001110000010101001011100000011111011010000101001001010111111011010101010000011010000101100010110111010110101100000011111000111101000010011100110101101101111110000000101101001100111000111101011001011101011000111100100011111011110010101001001100001111011001111100100001001110001000010110010000110010010101110110101110001001001010011001010111010000111110111111111010111101110100000110110000011101110100100010110000010111100111100000001101001111111111011010000111101000011110110001000100011100011100100011010110000001011110000110001001000100000101101000011100011000001101110001100100100110011000001000100011010100000001100111100111111011001000010111010001011000111100011011110011001000101000110100101011100100010010110100111101010000110110100101110111111001011011101010000010101101011000001100001011110111001000011101001011011100111100110001010111011110101011011110000110010011101111011000111000011110001011011010000000111101011000010101101100010010101010101100000010011110111110000000011100101001011000010000011010101010100000100111010011010011111001111011001110000010010110011100011100111011011111001000111000100110101001101011000110100110101011000001111110001111100001100110000100111111001110010101110110000100000011001000010100001111011010011101001010011101001010000011001001111110011011100110010010101100111000100111011111101011110010110011110101001110101100011100111010111001101010011000000111100011011100110110110011000110000000001111010111111001001010111111100000100110000110010111110101000110110011101101011101111000100011111110011111110100101001111010111110100110011011000000111000001111100011100100100110000011101100110110010000101110100011011000000011010010010100001100110110111001111110001001101011011101100011010100010101010110000001000100111101010111101100110101100101101001101110011101010101000100001001100000011000110011110010100000011001110110100001011110100101111111001111100011011100011000111101101100110101101100010101100011110000001010000110001000100101110010000100110111111010101010010101110001000001101001001001111011001010100101011010010000010000001110100110110110001100010110001100000111000001101110001010000111101101101000001010110001011010101111010101110110010110110001100000011100000101001001010001111000100101111000011100011010010110011001101001110001000101010011001011110101101001001011100100001011100011011110001101100100011100000010101000110000101001110100000110110010111001110010011001010000110000001101001011100100101101101011000010101100001010000101101101101101010111011110011101110011000001001010011110010100000111000110010111000011101100010010001111001111001010110001110000101000100111110101001110110001010100001101001100101000001100001111100110011110000111010000101011100000110001110100110111000111110010110111111001111101111111000110100000110001011100110110001010001011000111011010100101001110001111001111001010100110001110100000100010011100100110111101001101110010100000101010100111111111110101010100101100000001111001101101100111110011011010100100100101111010101001000010010010001000110111000011100110000101101110101111101101001100100000001100100011000111111100110110011001111000000011100010100011001100100100000111010110001010100110011100000110111111101101010110111010111011111110010111010110010111011101001010110010000111111001011001001101110000100010100111101110111100111011011010111111001011001110011010111000010010000001101100010100101000100110011010000001101101010011011000111000000100101001000011011001010001111001010110001010100100000101000110000000110000010110101000110011100110100110100111110110001000101000101010101100101110110010000011101001100010010110000100101100000110100111101010010110110100110100001101100010000000101011011001011110010100110001100010101111111110000111101001100000100100011111111011100101011101001010010101100111110101000011001001111110000000010011011001000011010100100111011010100110000110010001110110011000101100010000000100001101111100100101100110111011101100101010011110011010001111101110111101011111101100010011000110100101100010100010001001010001101100010101101100010001101010000011110110111100000010110100000101000100111110100000111011110101000000001000100000100111100011101010100011101010111110100001111000001100100110100011011011100000100100001100001011100001000011001010100000000000110110010011110000011011011010001110011100001110110100111100010010111100101000101111101001001010000101010000011111001000001111001010001101010110101111010101100011010111100010111000000101110111010000100110010111100011010011101000010010110101010110000011001001000010000111100100111100000110101100001000111011010010010000001110111100100101101010110000110011000111100001011010011110111101001011000100110101100001100000110011101011100111000100001000001000010011010011001011101011101101110111101111000100101010101011111101001001010111111101101100100000110001100001101111111111100010111100011011101100001011001001100100100010011011001101111111010110111001011000111000);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using other bases
+void
+test05()
+{
+#if __BITINT_MAXWIDTH__ >= 130
+ VERIFY( check_from_chars(-0xd2dewb, "-10edc", 15) );
+ VERIFY( check_from_chars(0xb131uwb, "z01", 36) );
+#endif
+#if __BITINT_MAXWIDTH__ >= 818
+ VERIFY( check_from_chars(0x107e57a7f73ff64fda25c25dcec8ab8f602410e8efc0108825e71dd2f76a1f17e866bfdf96b61f60dbd1be9aaa6a1a0a8e3ae37dfaf3f610eb13e3d27df2ea5659aa25e05035512c170fb6b169d0bbf80b9f65f6835c076e6feb40edde2b3427c56a08159f593uwb,
+ "21v5f9vn7vr4vmh5o9esti5bhtg28478tv011215sset5tra3sbugplvrubbc7r0rf8rt6lad8d0l3hqsduvlsvm23lh7ouifnpeklipl8iu0k1la4m1e3tmm5kt1evo1efmbtk3bg3msrvb83mtsapk4v2mk20ljtcj", 32) );
+ VERIFY( check_from_chars(-0x107e57a7f73ff64fda25c25dcec8ab8f602410e8efc0108825e71dd2f76a1f17e866bfdf96b61f60dbd1be9aaa6a1a0a8e3ae37dfaf3f610eb13e3d27df2ea5659aa25e05035512c170fb6b169d0bbf80b9f65f6835c076e6feb40edde2b3427c56a08159f593wb,
+ "-21v5f9vn7vr4vmh5o9esti5bhtg28478tv011215sset5tra3sbugplvrubbc7r0rf8rt6lad8d0l3hqsduvlsvm23lh7ouifnpeklipl8iu0k1la4m1e3tmm5kt1evo1efmbtk3bg3msrvb83mtsapk4v2mk20ljtcj", 32) );
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 235
+ // 30664178903177895962182284621809541028218926436213591560715855479110857uwb in all bases.
+ const char* str235[37] = { nullptr, nullptr,
+ "1000111000101100101110010011100001111000001000111000001111110010111000111101010101100010010101011110110101100010101101000111000000010000011111001111011011101111111010000110101100101000011111100010110001100011000101111101111110011001001",
+ "2020102022011022101211200201011000222122101212120100100211000101102202112102120200011102000221001002210021020011110121012022010022020210121120122010",
+ "1013011211302130033001013001332113013222230102223312230111220320002003321323131333100311211003330112030120233233303021",
+ "34204213124404223132424304330034423322123003100421142320322344114333231400042333332122034010123021412",
+ "2501003403401034230245013434142331320055523514134311321240520253214001354425512242543450133",
+ "213031503522025614316130460336111535140326111511162563001556005251454361610146451163",
+ "1070545623417010701762707525422536654255070020371733577206545037426143057576311",
+ "66368138354621130878355510324011382472520142027032707204417168108223546563",
+ "30664178903177895962182284621809541028218926436213591560715855479110857",
+ "5193655752857576a5100425338144a54a328151396a284348648a29808891264901",
+ "222b1966357857082b809b76025482822698aa4a14b43a17194400468769bb6949",
+ "20581ba003a63a164a86ca616b24760004856134a77a397ca22382cb26774ba7",
+ "3a4d522431c24d9b10121467cc9210cc70a0c2447433254c46758d7d7b3933",
+ "c79a3be56bc1ea19794e59d3a9e430c8a4de937844beb310bb815801d33c",
+ "47165c9c3c11c1f971eab12af6b15a38083e7b77f435943f16318befcc9",
+ "24294ca6b1e9ded52fa60e8f4a0e4f6a8e27969d874fd336409g05fec9",
+ "19h74c1a99dfcd686bc84h4eg8bc6bb6h27050hh788d58g7ca15e6833",
+ "1830h97g2908e7i82ef9a1hh46id64b15e22c4df90c1699bfdc88394",
+ "1e0hcc7gf80ieb097324jgd4ii4fe1338de201ig23h2b3321h48h2h",
+ "2bhk391kdf6e6a3eh2197726jgd7j4795f3d24a319dji89d65e693",
+ "4ha121hei11gg22ged57680fkf0k0g63d27kdb3c9ha55532afg01",
+ "al7c28alb48j05a79bimb3aamj389c8cm4j1c35dhj1gm73f4h63",
+ "15m64f3ckah00h9481lfhfl8ag1aj43dencj27hf3916ih0hn889",
+ "3m4bgekmd8eefnf3odhbd0g0m6mh3cjl9ihgk0miih7aj11d297",
+ "e5jeaj1efo1e9hl159l8815e4hcnjj9l4ambkmi3373pclf657",
+ "26b848amij40qhanf99m0abkebfi4b0p12l764cg58386lgfh3",
+ "af77c9m759pjorcffchbkmilircbf242hp46q2n9h688fg5mh",
+ "1rlh8qh26haksomka7dd2j5pkb9rm119o970dn04ps206qcm0",
+ "bftdqg62hkd5c9fdfd1fsfptmeoprijbsmsmtbs1hij6kc1r",
+ "2eh9m9nk082ei7f72h3io2incbtjshqdut05lk416nl0iueg",
+ "hombie3o4e1v5oulc9auqolke087ptnft1ligvhcccbtv69",
+ "4ad4fp675fchmdejb9taq8e6d4jcqkbpminivtwrf202kic",
+ "135fdb6f5v0psedxdv36juct3e8511q320qtfdfg512gt69",
+ "a2v3acj7jnhp30adof8uyje34b1fm29tbdq6oi5i33uijh",
+ "2u63om13qigu9rpql9c5zfvpmj9dg5chka09yqz8ghrt1l"
+ };
+
+ for (int base = 2; base <= 36; ++base)
+ VERIFY( check_from_chars(30664178903177895962182284621809541028218926436213591560715855479110857uwb,
+ str235[base], base) );
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 512
+ // -5703471763188962899063433308439520731869372953450868147003925262718888041530885199598754693236806775695258577874348055646642615291464458106275713090215609wb
+ // in all bases.
+ const char* str512[37] = { nullptr, nullptr,
+ "-1101100111001011111110101000000001001100100100111011000100010001111011111010101001110101011100010011000011100110111011010101110111101011111100010011111110001100001001111000000100111000010100110011011010000110100000011010101101000110100111101010010100011110011010101010000110100000101101110011001101010001110001110010000011111010001110101001001000101011001000110111111110001001000011010110111011000110100110011001011001000111110100011110100101111100010110000110100100101001100111110000100111001100101111010111001",
+ "-10222112122111211200200002000011022222200112210222200022210120121121200222221221012201122221212202101101202101001122210100112102000200022002020112012202122000210100021221001000002222020210211122022011011102110001202211201012200121211010011012220200121121011111020120000002221021020120212000100012001121102212022202101000100",
+ "-1230321133311000021210213120202033133111032223202120130313122232331133202133301201033000213002212123100310003111220310331102203303111100310011232121222032032100133101311021011121012333301020122313120310303023020332203310233202300310211030332010321211322321",
+ "-4400310323342140000221332324213204111040424443304021433241211122212140034414412203423010222342133421003204302241243314001342011112223041240001414114043143241443341234224041312112300023003222132134441221232240402043344414",
+ "-251523540225240055320333145531101400112135020155413444552422332412215253145451040340331205223553544141023202223215213055104140012102055415342431231520423353004113201502503433543443304052344224430013",
+ "-61333411631311452305536113550122113015636165012105631355326210360143314560444514332551160343461403133200635333303566246011142303612224441431266322412406402364453064425603560411463660",
+ "-154713765001144473042173725165342303467325675374237614117004702463320640325506475224363252064055631521616203721651105310677611032673064631310764364574260644514760471457271",
+ "-128478454620060138880483880283517550887835648855671352331583315360608066465678023307831002866724568134373052751180554104186617534436500087236525010161542768671010",
+ "-5703471763188962899063433308439520731869372953450868147003925262718888041530885199598754693236806775695258577874348055646642615291464458106275713090215609",
+ "-476895809768537439070aa41595269450693325386691a8a049578a1590a40a03a7460522a5a3541396698083844a9303a9127a79844436122551a9322021084703586a89a63367a416",
+ "-33068700915a621442702a66bb1a7036a407775578786273660a762602442a7047a4156036441734553676a6958b9a0aa940a1457169b4a2567016a29532b483b80404924478309",
+ "-10cb9b1909976121176bbb6b4c20c5b25c10563ba26c63492995a9598992c74ca146b0386cc68c609911028975663c05175b787bb7238c64b7876a9223658506019280302c2",
+ "-16d371094cdbb0159bb8c9cc0ba726c7d28dd0464c57d84b140cc323cca030c7848902004ac2c23ca4d23751819c368a19727cacb25d1b116a622dcb659258269783dd7",
+ "-74b19213b2673e37a6b1c1e1badbe2d2d4baa114c3d45d93dd213a1ec0aa08469b55a349331a4ada944656c540d1d383331757647792bbce8bab70648bc4e322609",
+ "-6ce5fd402649d888f7d53ab8987376aef5f89fc613c09c299b4340d5a34f528f3550d05b99a8e3907d1d491591bfc486b7634ccb23e8f4be2c3494cf84e65eb9",
+ "-f29g52gg6a6gb6291fgf23894e30g722622a04c9c7079a76d8d8286c155gef6cb9ae19080cb83c25g4c5d3492f127egc98f7b3da251f685d8004cd855c901",
+ "-41ed4808429fg0fbh482071c54485cha87gb44d6a1b159b528c11chg2839ac1fbh0dag305dd13073ec59aeb34145e12e612fb843061c61a70df20798009",
+ "-207fa39b7646a1c7d90fd2ba4h3a73fg7336c9ffea501h9bbc7hf8ab59140g4ahdg3787be7fach120h0634dai33f2fi9690a5i068f53613658e550f5a",
+ "-1e6ac3ab2f86138ffj125ff15716gc42998095iga7eie1gafd58h1c25eh6d1c1466c5cc9ge5e2ed1834757d8h72cifc4d5e83ij64i770jf0h0dgj09",
+ "-284f54a1eee40hbdc5173bbe5fkj73003g33e72eag0872bch485jdc12dj2h19j655hbdhjkib66j5ak017jh46eg7ddg0k9hfd9e70i13f0g3kf7j90",
+ "-559hbihicj5i69jl7bid22jf9ib10ealk3di2a2laj9jdfk0a5j9di128182f34d3g7hk2el92deedbkf1ka18hk0e51he1lg5171f52jjjec1k9c0h",
+ "-hb2eaaf39il8ab53ehdh49eb3ea73ij0j2l69jdf38a93m1ca5jg1254i27mc2g2679fh8fkl2am1g39cdg2ja20846efci7fh58m638h66hjgcgi",
+ "-3dga7hcalb2iih7ddi8h72ka6l472bgfcl5dhea76b3fdck2339m61gdb879513ne3igdbi2hme66m328n47997mg3gk9km5did0457358gfbci9",
+ "-o0g3djbk02bidebh465kmonfkbnhlb6cbbk3o9lc3mf5cdm8jb0h4fclei908m167cfle01ll94gne9nj7jcklgb7f0d0hc8bjo7bdckkanjo9",
+ "-8hoaif8j111fm2d5poa50187doho6n79gk8ifidgn1a2085aici442ocmhgbn6d5occgl47pnh9dl61kd7mod8ecb14c854pgac1f0b2begpf",
+ "-3qehdmii2048qielqi8lfggiqpp5jhpnkaaka1hl9eb0i826e5kh0l97p102q6lmh844bc1kmj5igm345oigg4d6f02p76fn0951gbn8ka09",
+ "-27l7g2j95g34e1bc3erli3abierkdigirinn8j7bigkg4iakg44cmli1hg1koda20qi7o042ccmp67l7r99idjh388q7r387l7mi5nborrl",
+ "-1hc90oq2ego297enoa8q4ib2gccgo9aa24nbh3mo066mlfb94cq9pm2hgkaem59c1sb1cehm94kfs1ne8861cobhhm0b2cne5j41disshj",
+ "-1atij0814h31maij7gnt709bt8htln6a7t350ggrrge89l39e8o9ott75fk8rb9961ohrpbbi5bt9oa1oc89k1r9m3gsq4r8fh7skmo09",
+ "-1cbk1hdgf6501mk6d5eb7mqemgqs9k63bhg9n2baqbncgcst4amgq7r5938i31a3gh3kk95mtmbk0ea76u4og4af5rm8j59nau66rsg8",
+ "-1mebva04p4th27nqktbh63jeqnfbu4voo9s1719jd1k1ld39t98udagq1dpja73i1uhqi8li6vs91lncd6cm8v8uiv2od4kpu2ecnlp",
+ "-2ea2msned2agjmuijl29etbfapve8d5egn7jmjuibnaof703fu26ddesvcdt5gfcgdqv5boqgaws919k40ov35megvjhuf8vate7q6",
+ "-41wbwqa75vhk119i0jr56mbrtr2i2lkahih6si2rrsuiba1mcla8ntkbb30doo834p8e4qsi8e6oh4pn9edv7ab4ilw71lu4w7w01",
+ "-7sssxtc3j0pu7xh3q1u2vt7a8ct4ev59i7qshbpubucvswxt5icyaw5536evu0l42w3ou9griu00r56hmln1dfo25o9fa2tyt3ce",
+ "-hbfy2hg0zk3lazj6a07dn21zpmszgelg8dwxayv43ol85enxypp2k2ekbdiz6po1d25ybmgjfbcqlx0p9cb2umlymriowmqgr09"
+ };
+
+ for (int base = 2; base <= 36; ++base)
+ VERIFY( check_from_chars(-5703471763188962899063433308439520731869372953450868147003925262718888041530885199598754693236806775695258577874348055646642615291464458106275713090215609wb,
+ str512[base], base) );
+#endif
+}
+
+#if __cpp_lib_constexpr_charconv >= 202207L
+constexpr bool
+test06 ()
+{
+ std::from_chars_result res;
+
+ {
+ std::string_view sv = "34359738367";
+ decltype(34359738367wb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 10);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 34359738367wb );
+ }
+#if __BITINT_MAXWIDTH__ >= 176
+ {
+ std::string_view sv = "37985637301123963008723772120681536236860287245700899a";
+ decltype(37985637301123963008723772120681536236860287245700899uwb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() - 1 );
+ VERIFY( v == 37985637301123963008723772120681536236860287245700899uwb );
+ }
+#endif
+#if __BITINT_MAXWIDTH__ >= 2049
+ {
+ std::string_view sv = "-10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430";
+ decltype(-10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430wb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == -10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430wb );
+ }
+#endif
+ {
+ std::string_view sv = "23e2c3000166d905";
+ decltype(0x23e2c3000166d905uwb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 16);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 0x23e2c3000166d905uwb );
+ }
+#if __BITINT_MAXWIDTH__ >= 575
+ {
+ std::string_view sv = "59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3";
+ decltype(0x59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3uwb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 16);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 0x59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3uwb );
+ }
+#endif
+ {
+ std::string_view sv = "2157434427317757";
+ decltype(02157434427317757uwb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 8);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 02157434427317757uwb );
+ }
+#if __BITINT_MAXWIDTH__ >= 212
+ {
+ std::string_view sv = "-25137136463562376774153767115327363064061306122026717";
+ decltype(-025137136463562376774153767115327363064061306122026717wb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 8);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == -025137136463562376774153767115327363064061306122026717wb );
+ }
+#endif
+ {
+ std::string_view sv = "101001101111";
+ decltype(0b101001101111uwb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 2);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 0b101001101111uwb );
+ }
+#if __BITINT_MAXWIDTH__ >= 205
+ {
+ std::string_view sv = "100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100";
+ decltype(0b100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100wb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 2);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 0b100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100wb );
+ }
+#endif
+#if __BITINT_MAXWIDTH__ >= 235
+ {
+ std::string_view sv = "34204213124404223132424304330034423322123003100421142320322344114333231400042333332122034010123021412";
+ decltype(30664178903177895962182284621809541028218926436213591560715855479110857uwb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 5);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == 30664178903177895962182284621809541028218926436213591560715855479110857uwb );
+ }
+ {
+ std::string_view sv = "-2u63om13qigu9rpql9c5zfvpmj9dg5chka09yqz8ghrt1l";
+ decltype(-30664178903177895962182284621809541028218926436213591560715855479110857wb) v;
+ res = std::from_chars(sv.data(), sv.data() + sv.size(), v, 36);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( res.ptr == sv.data() + sv.size() );
+ VERIFY( v == -30664178903177895962182284621809541028218926436213591560715855479110857wb );
+ }
+#endif
+
+ return true;
+}
+
+static_assert(test06 ());
+#endif
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+}
--- a/libstdc++-v3/testsuite/20_util/to_chars/bitint.cc 2026-11-12 16:24:03.763752726 +0100
+++ b/libstdc++-v3/testsuite/20_util/to_chars/bitint.cc 2026-11-13 11:10:36.418871051 +0100
@@ -0,0 +1,380 @@
+// { dg-do run { target { c++14 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+// { dg-require-string-conversions "" }
+
+#include <charconv>
+#if __cplusplus >= 201703L
+# include <string_view>
+using std::string_view;
+#else
+// <charconv> is supported in C++14 as a GNU extension
+# include <string>
+using string_view = std::string;
+#endif
+#include <cstring>
+
+char buf[65540];
+
+template<typename I>
+bool
+check_to_chars(I val, string_view expected, int base = 0)
+{
+ std::memset(buf, '*', sizeof(buf)-1);
+ std::to_chars_result r = base == 0
+ ? std::to_chars(buf, buf+sizeof(buf), val)
+ : std::to_chars(buf, buf+sizeof(buf), val, base);
+ return r.ec == std::errc{} && *r.ptr == '*' && string_view(buf, r.ptr - buf) == expected;
+}
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// Using default base 10 or explicit base 10
+void
+test01()
+{
+ VERIFY( check_to_chars<unsigned _BitInt(1)>(0, "0") );
+ VERIFY( check_to_chars<_BitInt(1)>(0, "0") );
+ VERIFY( check_to_chars<unsigned _BitInt(33)>(0, "0", 10) );
+ VERIFY( check_to_chars<signed _BitInt(33)>(0, "0") );
+ VERIFY( check_to_chars<unsigned _BitInt(64)>(0, "0") );
+ VERIFY( check_to_chars<signed _BitInt(64)>(0, "0", 10) );
+#if __BITINT_MAXWIDTH__ >= 575
+ VERIFY( check_to_chars<unsigned _BitInt(67)>(0, "0") );
+ VERIFY( check_to_chars<signed _BitInt(67)>(0, "0", 10) );
+ VERIFY( check_to_chars<unsigned _BitInt(212)>(0, "0", 10) );
+ VERIFY( check_to_chars<signed _BitInt(212)>(0, "0") );
+#endif
+#if __BITINT_MAXWIDTH__ >= 714
+ VERIFY( check_to_chars<unsigned _BitInt(714)>(0, "0") );
+ VERIFY( check_to_chars<signed _BitInt(714)>(0, "0") );
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ VERIFY( check_to_chars<unsigned _BitInt(65535)>(0, "0", 10) );
+ VERIFY( check_to_chars<signed _BitInt(65535)>(0, "0", 10) );
+#endif
+
+ VERIFY( check_to_chars<unsigned _BitInt(1)>(1, "1") );
+ VERIFY( check_to_chars<signed _BitInt(2)>(1, "1", 10) );
+ VERIFY( check_to_chars<unsigned _BitInt(39)>(1, "1") );
+ VERIFY( check_to_chars<signed _BitInt(39)>(1, "1") );
+#if __BITINT_MAXWIDTH__ >= 951
+ VERIFY( check_to_chars<unsigned _BitInt(951)>(1, "1") );
+ VERIFY( check_to_chars<signed _BitInt(951)>(1, "1", 10) );
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ VERIFY( check_to_chars<unsigned _BitInt(65535)>(1, "1") );
+ VERIFY( check_to_chars<signed _BitInt(65535)>(1, "1", 10) );
+#endif
+
+ VERIFY( check_to_chars<unsigned _BitInt(7)>(123, "123", 10) );
+ VERIFY( check_to_chars<signed _BitInt(8)>(123, "123") );
+ VERIFY( check_to_chars<unsigned _BitInt(35)>(123, "123", 10) );
+ VERIFY( check_to_chars<signed _BitInt(35)>(123, "123") );
+#if __BITINT_MAXWIDTH__ >= 951
+ VERIFY( check_to_chars<unsigned _BitInt(911)>(123, "123") );
+ VERIFY( check_to_chars<signed _BitInt(911)>(123, "123") );
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ VERIFY( check_to_chars<unsigned _BitInt(65535)>(123, "123") );
+ VERIFY( check_to_chars<signed _BitInt(65535)>(123, "123", 10) );
+#endif
+
+ VERIFY( check_to_chars<signed _BitInt(1)>(-1, "-1", 10) );
+ VERIFY( check_to_chars<signed _BitInt(3)>(-4, "-4") );
+ VERIFY( check_to_chars<signed _BitInt(35)>(-79, "-79") );
+#if __BITINT_MAXWIDTH__ >= 951
+ VERIFY( check_to_chars<signed _BitInt(911)>(-79, "-79", 10) );
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ VERIFY( check_to_chars<signed _BitInt(65535)>(-79, "-79") );
+#endif
+
+#define TEST_WB_UWB(x) \
+ VERIFY( check_to_chars(x##uwb, #x) ); \
+ VERIFY( check_to_chars(-x##wb, "-" #x, 10) )
+
+ TEST_WB_UWB(34359738367);
+ TEST_WB_UWB(28737511161);
+#if __BITINT_MAXWIDTH__ >= 96
+ TEST_WB_UWB(39614081257132168796771975167);
+ TEST_WB_UWB(39535566475881661008803796992);
+ TEST_WB_UWB(9999999999999999999999999999);
+ TEST_WB_UWB(10000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 176
+ TEST_WB_UWB(47890485652059026823698344598447161988085597568237567);
+ TEST_WB_UWB(37985637301123963008723772120681536236860287245700899);
+ TEST_WB_UWB(9999999999999999999999999999999999999999999999999999);
+ TEST_WB_UWB(10000000000000000000000000000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 2049
+ TEST_WB_UWB(32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638215525166389437335543602135433229604645318478604952148193555853611059596230655);
+ TEST_WB_UWB(10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430);
+ TEST_WB_UWB(9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
+ TEST_WB_UWB(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 5132
+ TEST_WB_UWB(45454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545);
+ TEST_WB_UWB(99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
+ TEST_WB_UWB(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ TEST_WB_UWB(500882482601711616244768087890063937611956368892437854816254243427723514889077863272376532720233337025259558585726815795455737345529703167217376591190386757291260467979087896991586804860732731995521077276213997642539829739909881215843091800750729242398039027191237222313522701477864259418802125051667890925591531589936786201777943703970228533935680241797537959070640154522864713174956535356257530847777068400960941969112260801490094781122726426890078508769040640619007965948281621175935945738743903442745401153603327173029525621489788095048832757573040700040142167526412911687642009685382365960561211323134340360633403593432272075948650318681239603716228982661813003788923480657045172912699095266033068826816785999539627202823157225283559445676391855270017516320990830538769457803572137918888518336276803278106849890745679942287513720976305951089261462049489098289463377504748000006035490926703389960116009868048504017379422539029931745584472504410379297512783366576724535054845870358856596826634888242422847006039540464890275160090529949025464883700696791800030651160623096277848350116087905966891769686314866167725971636935870804474253191113882352273005489896437905743333394039888098721324394988507117985882478385940926496732228439288435000496598583116222513135776657417291310854793672847408119140072353799943869425784516195335577399047740163647825222547221897021183406489016361222125361833926514704272540527124928632392086015494922641367453407790513394842447850809082124058261605266534050055043946962964352290512622427945455100046820734985861546556082002459330941232953697462029863178251860055191420227594050999800873005976656566122977291996365378944709765099430189819844713060323575254364521715565842321181462850759903889641082596362672163053278703409602096194565947614901796719182127440867817997222670119560807598679662631415244537682465285357576454231981242852290264854296338068971876119398054575289695175493883930560350004887025501415443397445374883081302147438365886751946672601607254190952040435137601279417523418300701137334756998122966826634982910180123059618703820154791725233451433030204087676908587917467406255242255790714837517968547644790310384224378702065476211986642934150251473119163861460209583697636036204421063831801828896587336901284354944881297591258049505027191184592170632756295844383477215356546200093502020559526019117219617911888236331736915425106115265827809505283647173633050029141019081755768573106512895702767596754586331141908906487857508009358185195219764070915851741257711056463991759817967365289628448346618924937142167519955990151098369712715412315076236265435853091457088036201681669210451770938715552852059144950740300006860331109608100582814350886254838107194107720058212713971522490693614541170214468778951753685940966994238762497910999571089322603844535859711825871065475847210373507841534963564408894276333895051655546394265020637822223333056609070496209653309892669047852409633458093585939707714808430571161071999061401369233107249608163169344593293322015802688302809670151168677107012791622177271192572802040276228138899580591561217139162850671160302423745647641379804047026085306709749070767913717131384228712574884918875988734592963351475024046872368498220108124093291438450918396677543945998704617949624561737015133020499016545858503119024159879944505360299938136676020152124836044564071273181630927474662884865548251151841126981553243979424573473091753792748022882891953609947812118926559451150002479573330326720142511647864596802022004221861458889481564616281190771787141578382233541529372654381667873168044032082711318484117311145723142847219459764075120620949959923007305553871536475593369555670630409989360200431786036544889806543770972255018542481559575070571562321045667810851437856047142498568082901749678246720692955154303613285643736003766534865792299407295376644936381559047806212015972508417268591497306587391028666375765741490049930159050650880479444185167194365887343829724896966570531367449275516436808180343229536166664855468000868627235707727883797317778571777094039805595069151331955837915388787342343944616667536429492975306779453195112560006596189697084849204490737672699704280422671732384562132457505869017113528544534777662140059137438556874307751903782967506013477627728454460930447855632146858024631239469508670925834454605361004284672031062496104654532317799633328845641830467605382657799437133803667738833656584152716166833073102469962314172777379035904650387227435060478377405760903049032041487629666505507678903421183091165217226253565978476628765977049844713079591264974324781351119860856291693574914952962308287888818220818507088172110602188202820822495156478168424886561835385833375036807857653187597576849283813017334543460830737675262265466884858282696199503913782596189538921309054502604912563899045483746578978308259024115476497559028170299005860460840833648731907986525429163228455929295598574804068134615444016423635574469267845799704259241147172452965802744225088933971156116208926572863263189275319718006991341119931006351362033187097948532206605958792987299302449286484221884299682282707934508477754032136853844344428987932021027906899296596231055700593360481367497995918048032821758896326991735678354097758470688579653410872525235799352261832753619074965431356105838903059358928956483345701246560973124555695178987940689461777368779758370560353006295672178432048276063369549032110044119882876264277680743578642478805862910780462164393946632049391210877239596180730883639866130303957914437867824677056477323163909709162780170485959226029063167177511140060926050165927250485296389290118011160924233212515011732035126779767315348498475683883636391867578725971505506159987065125440607992326410166591656522551762221859724726874538216361095465729345725262955217484095665467075978818316145321695701650334375024148341156286522930795078232586969355308669779613697827777474448662054230626407349989198370950424789359925134385533621468646714011821687766355835473459774777646616398778411515263789209635304364950451783290903143269902792085965941916826838645873697447079082532310200209089206484789278282744507629110429170629586643418983549521239736985245823125021597444640873673303118356525765678436269321539230649157143464476383310160462254612832071158177317438457716827102285561914868609993337032702746599854344947414252671756683540491799147899897134458705747067531401460591397384922576618741396036995327749289385510814098944017621275220394572852062694434639947532282351827365696486126464853068298703188306288081200375866629762057240351661722576275627729059442612121557557372241677845138901989155183112343343506959191825050752903806752230460878913030344803937051714839230197553625569283274996932364899238204261145545489020241452925699515667472801265390185581421710567826573752466105463367702601782229411726637709032479173694505955625697416960872299852414340426146696560638501735629173494823156178631236352214605681538438815017976084082299093944375544001298950173461908947396719622384218030724639451706629548175908024870038968613893793828184117855323884123521096396653802003028769768767138336122314673320964913253318011742673642886739838414642947223715583323116300683963297133342737113850834141339247043145632229514158872090935948337102961395042082956919208661572998901378367509786969202160080657404160390166877038427661680777115491061884372638436201329556500677554100245146124381505758910009520868013287485293241434196266605350210674124275810479795530303301734942285980842093677307066934677033059170021731175872896710247788274578853015891530796876076366884245807706991614354405201648294316421460420459491526536240858136027926735425055664454339587814955270192275490263057315969936262254813577975155140476644363104047978296883496012335994205827574616473329593253952398130707301705215557583146320029816624078610329110693250809448068678082674104287486383065258868786407822667213586356717447111935745444373427529403662906045904170063703824083827122712485751690913701525735023673437652461397139510992621478612396111269994624261395887671352186290829116029520780769926097462297626646896606452684605605147797985418545622613175072065995764487514335427871757796785708546124788364175728820026121286294013826742860440342145596025696914831165672494604579905078065605294347869302001220894583392301133483988313641224257139647433876437808782384135125710520255696312194150893561591668287170069871513111445668406557713244566264278656211648978552569530697235362040998743470471155692061212905512954269180542465816425413579229935662807510439332476118384418134211448188591353206638395464511710017341929651255017636811887100201382606237963623816811815336829543685545019643673366361784009243971029507352009904186736572135169793034650306354875954926134604317001599705164082198209895677127729989709862074443911788006533217772381540854426787910724871988391213638388287188744533502491213624658956211922647508279240325941531980866080782426657102826856761550508003342087596356340078409190893803151176856327802308350709370737363276181854742321818893006903818067070844185348356413163320767117499399274437501390222483171256262303221017068534970407885114122587693967920018513921431005439671359763307033442676853957689067407079238921856015131931621463262652839096212991479742162399083892054243859405357694666483682612541205608241222817677474519169156417879317265514703887416595643457318545520569740171122055745848704167746009756070878576703441813365031501817315742367168187698586547609999154744902982187629860589100661075817934335397820374014042088497047142371011335577856153389981318082516220406866680880937808577973360529721271269839540962248621886189082922303467418893575684488446315635582256220261795484759305166723675551064709223960234999613390237217486708463144918790470539852745406229685453341181741280995169390486978139489361617856967156013437644026051066787341521245059568670143995647832751729985476162976632792977231519487279804486601838782408466130758918336397008328299270091364296197887608163724889926465722071716651654505470562150536249993280541034542663370043877609601656103205700904162226064344410239081620706314601917261402109872581322631584383079127271920334153560599577382701637415469845487280008479872373516283099704160520022098888735559274183710018160676425291272268799038842546566199364095296964043864278350118452690690753738327433793545163869778165234508577844633133220883338006233591494782335321213742736706582268957548268166334445639828582777740962013485214820997226949052619961979921719134996869273978197181868968609951694956242069568050231612486139845103652192660485452610189567451422009737413654146995976165146911335452572476798573255443629994026123760799210375863878511205232233344664340763207654997519437181730749652069763292922969144715227235454264498351222554610389947773169215699149395988120981683720908686412921754041560160606060307240279502653920585634848045013120863680944804977807148978547969372948455835002519532081626677570445349007280228680025236969688137815843221055588467372516981916127908689525298468829914310530369009571193693642926144652604346436977825477145969472538083585753251320699259645089953795732400076420653022987735934331363542764095971761882237640990257460910340233910408147352034495377923334654949334955417690251151995024004006205774235760951739155030803412535137396562653820647008255727096453119617328930080808400474867359411931680469844206607957095650891130174867157554012218632106090898389655583376558986250722639645402818835445937613984031532713160207012803468294372550062388184683646489101290207645763442683133492888155111176357393384590278419380792493185073235418551105812028468768907829769568047216013343673553460542482215735119908826287640197031591551624307814394754899718260298906556835932225129140277773527936319491370697617812645499769374515955389844221386624705734746352072831282269119596580623695254188372923372322026050753902570846535956844540236585333845894585191328580354287663969386955063113695164325335569367654186060492238153291068526173868655370939072074942951046696271136741404787727173968562796108959326647737865245112811852352843474981955623245841949002753846774032437426391575409326800687683689980735948098456106855296539559040329471598138273779297105324627076809564932286035562894850970752839770832912964558741805314905453126764528439873881255686818668592471782981667692324799771116790307184714614396155681643332688433893205987904241043799668753170436357330934573535956203594284965476679164393236451951205139877970421797018803242958159110538834196937818691735197529264377454893771140891304347386044968768630963613800033393008333094973768598476328229553063814958447727365907550546338462213706265724428904240965178095692931405328365137350442603395432982940842534083063204781886797860862730177962209591704543565835737402967522875762291334866190929441609780199586873656849455542875522667547575617440537819630489035517701615407843309129463494073023006375072240503242535344910009513933737317268383786490302168699136933423239693407158915035941991009607699216034640861950332065321147296224632012012211045205409855993503590725870416364528613591615008122654690759875589100511132687052560341723799161055334800189369782170951293787658665642347984435070878018916565207472622969321958463044630698011442961741463819697611890548165998002102325518918481340933907097707454394475538300526602404343320899623516663035299545952721128864943223791143032974449476872985253287092136159904226151757526899204733435304393997041281750190315697292377601578964409383696855017555512767722814403090414506701703964624963157866469521654200183316169207551597924300766223601407048851547671310500763365789155472831827267421838295410273628572009151498805062062221677888607276180482283562086609676342127162187274794703167641416346797762430455010592873185041115235864961348134176533052654133271415505297242058501438168871525369248422184552396138052892980869921722040213407903965720037598987354632372306768602707051792325846954521234051004563805567752746413361204301867689004811478899857768237394549469647644735013135030716879285627796089109296013390756045306368316523325677599492022766234818180670758852616908147838819920959426254963808655305714602639279980432929492451084829426937688906764011957944961111909390063659258342311778555203879993422842993790810325687178049965851137062131142529638335668816178994577682811415857451305363873539063181007228833338587335304465509251815078819967692968122808623619286977380183690346356371327888193325257585619208966374023430581001788629532433173020264606022639431411450920365558623297427034724285824957836904449919928113445577675934787868469673029796891675079830320474200830674148614821552651859706854229866290566908135166267720267757598544715141223442454183539756481298652955910736413167343050788876175053399711573189503131928855504157488715782581228077757406980930974941604200874285306631982976909081534203536379094164139959947122345433270667194975490721733074149344987982905296803863821848542560917471398472198329186133340779885379601022070953798355308530705007737578335262676190039996996368132297666305619829928860082948709209343305205471443335405964110345175135478382561485978375638632971613699063065062940732093582616275590264395878637684860834902554057418865353945281799250434652873569875352813320155313693952628243022116315789523701658421917536827683385179427719153983964203524553241932689799345743360361314172192713831142722239580248455858025679556028690933197839392153855313212414475833773288194231376461411002638048161126328018439071936249540911583208954035082543953491839856831922612230090470096688738937951722514633231800373480875131461286676745657137064470816849683805114307059822551786205554971396775724247983968268569453789939405191005987810965050508149149062553144587489427521406596529558453329627253671644266002669069654395943193223973186509850982584317968462634228239281678766724172123470221285735902490503241689769806270568828453212462881725732925065784082235523949394489831908882790516688372162829330968109687015878328628161222491897457203231370019106296646622560277781825339299295345400645794626733061001999664158842886022113716598295427098933945199764932709773720451015233989797726868490226102537629080437420353025191429794370941838937750183404230596634357269864450800010584363201891538260732253623945157408534595887945899941177212837251214243424491309673961498648898022677264739222862785353171126365529486256652937541732065062737692694552987608154345805890609400444199840699024842243797848741258339626788854609114213154168560922230092759373832106481782902634458745185184789658454491914606314509184301617337812163059620335415952015376426207264972674112984110004649280106430751829102502479246881065094340544440857655404186221232702732475252379493635391062801205521678646712313783111066694281965932052832884056075272956097810845053511560555837288389879222704072121997497068407611343108043570053938944491755416579261992432043120848210253910568626817944817349982435077018192598753395386285623512256634026456352343278663276235845621094929651734303611150206699500617807372351440463473050856402075674263219155344343398598556028676768518225681365326839635436422854861621906089420599266425796042116885183366586573418495905001010350178513569408120033185550671348424717446901752397512171162656692840767744955251639321275326650252695158435836193268369663470435670307685941516660828193839116644650928798230692110114568320810952053210304694033010615116225200263682856687315206730538909351371560429257756979999235661405238904954113636915511255602862351187337458051701797838191996686953364550964892603366544484307133735007907899886023421022393133359675746679457442593333201700441159875522505985482874778752276319205279877749765791537577896395708895651794852513132145902842490325860697543452946853015322045515505815962465378914112807511948241890904586442026260835442385766884510278482138448132310336834870262633006427182046576822789727833985503690468166072891009092981900576570960162606360435583866137496763829681721981606025536840924656365936789936088735860974932512935631277719339471597736703024168357038146479981214410122013767832453574839977865809979778489981688144089751861643202547951460451835556933680349430804557942929229100027206528137273340296695143930597754546542137277125221318068593553021631213093114062174415561346204824667782363236378874257646479826799624276353545409242244032781686006752412166886483641764984248866125139730407011994091421533329140976848925818008597293853816875228752799714218177212048882919232920318223035757844204504111369341879588374464481069115838540608400281490063027375403066027586520866412058899483568514217212306114686373444188030081175950758872789386207823818972984973420219081921359692389423720355711077999648925181880348294209457942584782605765239749784328671142252605523790491767626605064183468361528913819043998181787969415002559736190134947379236427200682184056280269056022952516675220868684401289071383485891460939067810311114412915766021484876986887730115983061300633865908611197938915431490546799819796643872714463237503210057258765378734327526752361537752903428105940356680635433013989800695532331431486786604306244330329095461331638819901067635467874059146313114662233313536265660584471412866167651074641195492115398415822238574945180635566197600154004937993751865136287515072951659567874254027746987834158442844608604048513280361322963795034143889666903754843257422983019030002313766270395818877124835192199313092496755891982756701034186429739160357963169763679292490747590753886411272511200697263925492082078407679749424788291669802239692143072650228868229909095418399168489993927581503892980059337145130282029364652516288149720960778627973720138032286443924786644382510346179281144491262043964098768223834384938955521944376518084861396973976429789183);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using base 16
+void
+test02()
+{
+#define TEST_WB_UWB(x) \
+ VERIFY( check_to_chars(0x##x##uwb, #x, 16) ); \
+ VERIFY( check_to_chars(-0x##x##wb, "-" #x, 16) )
+
+ TEST_WB_UWB(1);
+ TEST_WB_UWB(3a7b4065e);
+ TEST_WB_UWB(23e2c3000166d905);
+#if __BITINT_MAXWIDTH__ >= 118
+ TEST_WB_UWB(15787be5810d4d9a633aa75dc35e9f);
+#endif
+#if __BITINT_MAXWIDTH__ >= 575
+ TEST_WB_UWB(59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3);
+#endif
+#if __BITINT_MAXWIDTH__ >= 2048
+ TEST_WB_UWB(7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
+#endif
+#if __BITINT_MAXWIDTH__ >= 5232
+ TEST_WB_UWB(4b0a92a87ea1157bb05adbcf68b78bd6d0222c711d92729f2d66c125281c9c73272e1ba5cf31207f8bfb4ef3b3dac983fcf6f4198867b8b5cd7adaf5967668bda4836274b482f33f7e4232311cfcb418f2a9317a10ea2fdd6409d2fa803ab824bd1a98729d8cb11bcee44ceae00002d2a9334cb91d7b968184687c04a23429604ec1d2eb4d83061b67520547530719fc3b65b658e04cda65b55669578a92b7d85489c4a10dcabd741dc2bc70cad56c053b225d1b6f3780248dea7b177c33f0d0bcb472c97e2f3e9bf1fa0bbbcf78c00a9a1e260955a62de390a9fa0ddceadd989e4f621d7ea0b8709ac42b693cec74d60a9ae05f400d42d1b63dde9227bb2bc60b8de3892d9bf9c75f25309b11a4721b3e527a7f5fbd5016fa2ea821e9d3e7f460ca7e8d667754c59c8561ad29d3c8682543e78400379afa65431b4e16034377cdc104333859f9d5de5a82072d4b6f528e56d68e8d7188f2b4a341caa68441744546a77d9fa0527dfad5842720f479ae4a503cd8c1c4ca75670b3f0e8f8182d4c7295266caa4e3c47967ec995b6547a6b5837e764748ebaf542bbde3ac3fb873680ad932aebcf72823e3c17f480925fe8ca374d4eb60833f8b4023377fdbaae7e5831a933f11bb62f47de13c86063a12a9afe6950f69d49aa9f7d128d27b10b7fe2a4b3d3b069f2f83816b0987a61c315502c6646c9afe1592cf3e644a4e1c48786785b36d24e2f1a54dfa2df3165e481924ac85beaa9a5079d8b5c326d10b9e389051a5b533965a81918774a7e5bdc0096945c814e0188db8cd51df9e5c7dd6edcf7ca20212fc83a384f84b69b50b731e513b323153c0e92111c8bf6d46965a1512fc1724f99bc87d9313e6481e59666f9499a0e8598a096a52c8d7985e32ad702ec59527605da4f3708b3b8ee4);
+#endif
+#if __BITINT_MAXWIDTH__ >= 32768
+ TEST_WB_UWB(5d1e578bd611934b21b43cf1f2e800989ab3dd46cacb7d8ac94c9980e7c52dc4e4844fba95e205b69742a7892aa821c45bfe0a25c988af92d44913bb0e407ff2c4cfac59b1b21048f4b7d21e5ff3e3baf2ede0bb758f4e49d86104e7a184d9655386be0438ce4d2c861f4ae5122da0041b80c0900f0edae86fdecf1062a875b52e33ba660207928826dd6d380a0d3d258dfdb69d0b90857a6e548ad1fcff862b324091344724bc6d012aa60b37e331c5e0e762eb77e765e53befb637ee3d62207df455c5181132193bd82473bb55389b3c9a86b381eb99bcda4ff3c88c56e90a4a3ecf624f017b8bda9ffe95f5363131d0b7e551a37e0d7dcd00465a562f64a06d3302bc347d470e1d45a4127bd5434b8c289c2fa6a9ad74aaf3ce002232a18f65a34b992193a83ed84c505421939fadbc3cdd62e58ad68f7da4909fd6312e3bd479d5f50c7d33e5c98339ea17d897d3147435fafe0c897bb0191a874a48c21fc29714ce1448b3ddcbecc7e2c55fb5d9d3ebd3d2f75d4da776682ec1b0f1e07288f4419d3cf47a08e142eaa6a1a07f748b534682b0942926fc58e7ac49c71fd1bc606ef854e900352bebdbcc8b5b4016ae87985e1bc18417196cc36233e234ef42a2e8978be8ccb6d3a8825e03c374b14a0c0f65ce937ce7ff3f4a33227e2264200afbacf3c862c670e52573a89924f2a6335774c6d35bc612a5f934231b99442694f0195c52dfcc37043fdf9e63d1449628b85dfb13230eb91c42dc37db205d701076cc6356999a5ad87af83c4b3cd274f42f6f08527dc16ec09da69bbe030bce7ad831d071cc2a49462385915f58055487755cdaf21d48b2baee4e78f259476c31783ca24466ec8a89711ce9c9213d5196992b89b6733b706289e954e330c014a8fcb7ed62a377ec1493d5deb5122f4bab5ad461cd10d12f99ba837cea4391933f4880a2ebf78eff8b63dd40750c8b2066608134705263090de786f72a178a6a5f0a0c4a029a498dfd27cd723358929ab813ce286531327218b86a43cff4ad2effb9780153c18e50e85bc21cb354b66c678494ccb5c63fce7ea9114d9dbe7b9c77f39dcab52b1a9d86dcb93a306fa697f33a63a901a2777f4b88cde9464885bd3c2387f14ea18ed57d480fadb7b544abefa754f04acb7095533d7e99850456c127ddb2757e414afb8959a8400eecebfe933feedd0a5e735d9bf1f621f54ce21c299592a7d6dca25f364a9f44368b42caca31a7d58f1a322b0c294c01752e1e9fc3b046998ce9f8c23398076a234934ed7adbc20af6f535021e810393af213273d1790c5e620520959d27ffc07133adeb0f70f505652a0783ab0a165b2c49cefdc2da5b24df7cb97ca3b93c14ecea00fb5af500bf200742cb1258263ea1f43b63cf9787ae13412bb6fa67cbe651cbe2abc0e26ae0eaacacfc05d23aa6c7750a960c91441fd26fd6ccd7a1b3286c95d42c773e0d61ebb95df08b9796520da0e819322d39049c0fd173b0849c1c19704890ae55f2990e4f899ae720ecf4c0d50df20246f79e55c812054cae21651e6af5ccbfe766ce37ef681e0f5412d0291fc22b66b9cabb81dcc1cd8ae232a84c28740c0fdada46ca4264d99676a9c0966cebfc25b5b7a79178741b5ba7c3a7cf38b3de128d25dccf89b666005f2696cb1192f1c7499858c20c741db337c4826f78618205865ed50f143b0f7461a53f7237303981c89243d50660883d240bad9c6c2fa2f28d7701a2b2111613b65585ee86bf6f4e51b2235712ac9436b741d323707515feec16a09e27b6b1de0b36cc91f53be046ed039dffaf323566730889e47d9ee269b58207dc38b8ba43ef86d5e4c1b52baeb8c8ad68fae3ce6eeb585269f634d2abb6da88ee92423181c906668abb91397459e6dc54c9aac2b502141ef948f0a4feca2cec5d6f1dde382444c2dfd5fb532fe22f83abda4560dc597ed5a16f7a9f39a68b9615a8754dccb910ac8f0bffbeed2f41990986f9e5df78bb80e7351f20dbaab7f1522c3e1fe54ecb745aca3247f973e002f9dae8d852a35839d87759b32110a4743ce39322315e968b28c9d3223cb324368d0c0edfaf671887de723b0082df74bfc207e1f465777f8d4052af7d06d4b393e0c17390288b1707fd520780327b3ff48220e8e7976874d8ba2455c0f80854d8c9c768f25280f950d200d0047b0ff9fd2fe1e4c649589e047cf3c474fb184dc5dfb5b73235b08208b0520c2b61052890e70c563064f534e1e8f955e411a2a9f15860238d10a595c0f7a2eb58a713e88e1f3ebf8333f3641cecba00fe5ca9efb409124219b7d7d9ae79c40621d7eeaff62c6e796062de7c4e987c4cf4253ba92e4deb4704c220b23ce4b85dbba60cb1d37b2a33dd08af2ba02b789550b33e7e0129c505ebe5b827c9708484179135ea0c5f1de968cc1408f78c9d4740dbc541048a46f06ffe17386f9cbc862df17039508d22b85936c150c35e97033a5c443ee68a2e5589468df8e2497e0f3aee488a7b6a43d4a004246362bb669c17aadbfd350952be4fdfb631283440622288ec9df22f71933395f696505d3267070d643c17b6fa6695b098bde4d81f06610ba3533b14e66ea9dd04f93a37604144c47e5b7a78c20f295acc0d32eb1493f7b7e732cccda075aaa56fe4dccf262094a47c0e1c3e1e4598ea53cad6675ecd1e45ffea129f60bd44cfa1209ec741326bbd4188fb5fcd9349205d1f87bbeca600eb90138bf0d0cfbf71f05e393190a4eed12ce930fa7c7a1ad999a29586489571d8a8fcc978cc88eabce623ed77c7db48f4c479ee40f308198caaae12f24484cbec8094654c1c4f080372f57a39d0c22d943b1bd42e24eebbce9ccdc1e0518ccdd220321e3c81273ff31cb92ced7c5a81b77556e69944a168e06e29c1c0b58e92d5c0b01141d75134f40a60e186ba623e30b824c9fcc531dd335a9ef30f2c85e4ec36f62d0d47610151c1e2d87c4516acfd3a75faffa7d73201752611a1abf58de1ebbaef321bf084dcd35c5818720415ac7a0fab21e6dd225b0333fcaf29899014437f475e70cb3b4327935b999870451280f03366cd55c2d189be80b24810c68b900dea00d82543ffb89e98500edd628ecd95f59bebb76c7475ec26bdfcec498cfa338cd258cfd2106d6a617c48c30a1559ffb044b61cb82c08dee905ca3291c4651e97bded69ce5bd32fd71bf2e1314be1e18f97fe47c30625ad0bf0df9db445bb4b02a8b4d00388ffdaa3f2bcd43d9db6cd34b414f8ba3aa5c62a8463dec91e2accc6de9cca669ca40a8e60decbfd94983248ad2a03e7cfc911532cef1d4a19e910f885da5e217f68afdf477bdddb130f24c03927a708f0b85b1ca87866c16176b9e7511808d080b8afc7338ca3469bc707d4eeaedcde6738fa0fb060d012d68af927a201f722b9a7eaec338d33cf543aa342e880204fb81a5e687a2f7a50b973785b756f7d2e16671b4af44e194888bc8a703caac0f4c41e5d3e4dd78f064b0761c076dfee8d4609d73b57f083dfac0e50e9b810dd7d2e3abb7c124a825d51e41dc8c30b5509152c446c1cc84cc8d69cb18eac8f0bdac9c756db11d93863bd552b8061808976accee2c8962e906cca42fa76d106519acda776de80ae413d046cbd65ec47db9815bd60abecf117b633112d04177e9ee42514c3a6c304e3c771a12c5de807f6fdc456a8b047bf677ad0947ee8121dcc37318fddf494c1bb0562e7624aee5847b3afef63f6aeca717e5eef66700c33a83ec285325646ee5ba8d5bef2c4163977c528dabcd6a52d55031cbb7429ee1c67b1a19907e88763905d21832137bc98fde572b9bb17e6101b02cc8f2bbaab926b4c2c7334b3d6c510f748312e04c92be93ce4a553cab56ecd81fdf83ca88ba7f5b71a296af0ee7be736ac163b764124b226c905f07f74bd0071b63c1a41e40ff8fe3862ef27ddd65d8aec98002ebdb25486b744052b02069db842b7f926c6f125fe53142531ea83bbd71bbb05d86d595f249d64509f6aed57ada450d36a41f868950c8ec6f71181ce2c3cd305a92c64cdc9c81d69330ac0e0ae11b31852ac81e7b80fadaf202e7d4c6a5051137cb5e1467efeafb1096f91b78044d0d3f051baa96068588096d6cc01261e14a3d3f5e951f49802fd0793b488d8845bc8d51571357dcab514a08215c6a02969731f52c513eac710f25bc47a3349d5fb1eea6d546837097cd78b919d2bba079fd95964ec442bfc3686c1b0b90a85b5286f227cd75986533011e4cd3d9fd4dc782e4065726b61a8f22258ab2cdd60554c82d124db57770b695cd9a6fbad8273dbc2d84d2d3af51f5c4dcb892a2bde77aeaf9b89071295706e6e16691b98ddf75ab54487ef3aa74c8772d5b29db3294b62c4d569d66ad945d8efaef3878beae1412f693069107cf08251a21f04cb6b678f40d066aaaaab8299597521e56002268f6b56f87bd3e8fd248b1d29568890e6c8604c720af7f4a45069c535c9c75b5833b250ae8539aca9c4c9d21a51620019c34c8bcd437f7194e836c9b2fe250a31d75bdf5c948b055854d872a53a73befdbf49cb03c83c97b173606371856da25cc881b85c0dbeb461962707d09ac5ce590f995cd7d5f3884854ebb9d9595b3621ddee7eeaac324b42595213f318e14d277aa9fe4f9d8798f17251cacbad00ed8aef6b749b9dbfdef712f1ea2ad237514ce14f9b7ed6336f49853914323a01bc296c30c40aefa2010193eb2b65237cb104cc4d82a280f1eb052a00376401f38d6e23527813f47914886440ed87bc9f8b88ec0d2b6cfe16722916a98d189d1b86c06dfed36177e8e9db28d763e476ee6d62fc98cefaae4023c5eab1dd87cc634739611b9ad80384b32b5b160fd1057c33011401fbc3421f882cd065b39cc8fad529156f0118f3b4434ecb531fd0cf52d1e454cca796eb2fc2bb9475575c6f2c85859c869d8f3ae1de0534fdd50350a6e7a4738e3a5ebdfc1a517171ade09e32653ab803c9f3e4a7f818a5ce1bf5740399e791d3464fcf60a040d14e206f8086a93989732c6d1a2485bff2a0b467a34d4e35209484eff4242fc6725035f3d6df2c5f5258cc6c7c512c6ff1e0d6952e24ca4eb94e3ead726d73e5bda9d8938804f2da5cbe46d80f724701531d96814260cffbae0da8207b1c0538c5ddcc4de1be273d7d6d168ce05d8d337b23b4bd8383b8319160520c7c57444135108e16cfb5544c236ad803c766364289eaff0d6db73efe18900a94e84fd61d5f64332e1a877a3df15340b9b976fb4260fb4fcdb28eccca1ed65f06253523859957b3b3de2ef0d08130893aa6847c067fccd4325aa0fc78765b7f9c90a2212af9d4ddd802cea883fe31bda5b53aab35067f67601f63d896bf57324ffa5379f32757cb2a2573ad23a46bc85aa5748fabf3f60b1359e3a9183bdb68352ee1285538f47f5d672d810c9849663dbdf5e8b1ebf3c444d66d5d1148c54676a66fcbdf634b3cca78bdd610073c4dc43135751c283961fea6be10ee83566429c53008287b45f3f302c903090650ce37854354ad7db5ab2373bb12f612761fd7a62800216df3146fbc1779c26747faec8a4e990703452b76003d6c12b38bea5ab3ea7b20dd909099a7095c0f5056fbdaa495e2a7da0d1dda4a89edfd14d757c8c1d3e89e6378370a819319d1e915ac8daa8e34849b515ee5da4be2ef223ab7e30d9f817018b97a994c946b36a917c353a5f8d74049352524810713a341ca874e6908be81c1391b0ecd8644769d07c942ffa08249d5a76d56ae80);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using base 8
+void
+test03()
+{
+#define TEST_WB_UWB(x) \
+ VERIFY( check_to_chars(0##x##uwb, #x, 8) ); \
+ VERIFY( check_to_chars(-0##x##wb, "-" #x, 8) )
+
+ TEST_WB_UWB(77);
+ TEST_WB_UWB(230475202646);
+ TEST_WB_UWB(2157434427317757);
+#if __BITINT_MAXWIDTH__ >= 212
+ TEST_WB_UWB(25137136463562376774153767115327363064061306122026717);
+#endif
+#if __BITINT_MAXWIDTH__ >= 590
+ TEST_WB_UWB(52520315450745642555674717372122700527123161473376502223641763366167532676101223667262053103273110464342371375366327514736450627345155327267556061);
+#endif
+#if __BITINT_MAXWIDTH__ >= 16385
+ TEST_WB_UWB(4204672440352274665474673642642742254033270056040647227124574166633012236544175320133357551706274456527456300064002355240217127547342035703710105243772763055637533033316134157167631571023766516306166345277317727346557014155444400535041326630643541072426165400040052744241137627727060403535401005124274422722132656323522423133142575664164053454767412233522214765151204472523155750301212643630521471361226130112252457405617256321222346463126167130215567613774536617017210141744635013027576241021725653117544421722317052255431345533546143115523245011137431356700107076554315777406421252035720372411723567155230366624602314603405670140740134724357554726757642077070670643173421441444500570556402265103534347221116411605031576740504371431605056252053260630202501237044622265716374067702756307722223330274012024554623056640060130437453216547156437206212275435430730470160645626075414405216712602544770146555430537562513137113433024241473521457675521754640001317712774466272054110115401241031414446441653137620356377056402155531022414742155043322155742472106166515617103122767012554033221353445512167273612514372130313121171270362231602021037561362005126462240354176401332332645463057375053127362240572535416355467542302245044131167555406131346625317466512200210225565311342106065120535562047357513440037026302122167245271357547222653643643414140771761365556521157011443032664635337550124242342700071334233043152657020444332144447574066442331730043202566631577645131175573623364037027361463756424632040152340504366472703370354602322540656301157574764334540572070273614601750565677520603276626424225107236605206440544146465050413116522623371510677542566736021200113576165563573124257774054125231353475370574276222055602267603425574202422134665633525304077720624673522535504756263000151034427777553120111777447152510051716217643545210514073344005155342354337006640125635627352727171002360447732554103510543561317104063505141106417464603103105023120727610255351202456747261040331675403206467402335444366414620613016716561530606217271130704446650401745275760551424436572644723724101641417623502634001600570314507767457674163040540776210226451244165342412470763406060312136301023077064730472347454441731154372727727153626710717513031077141227142176447022133576552110316037605230444517543615674125665540167161143551465106352627456710044762351327546765715736174514576305300043014614070342375021475570311204617673566042057710215673260673611732752635376506603463616605655773602563233262335330260246226355546104112061271116127204175763133710766243512526115420507614355275316325231336412520453507305047404631031757323123520121663673637056111371475417702154775124361162702502475733723144132002060372641415566471655412414373650205477232514101143332504652534466553002630666547332773406621110776102214243325776652744470210256040304347162732511667570100670071712234345403324132761145063625466670150517505636372537471437310561654146707307327120770757145545046352243320527255114161507266426727005722171223300122172600643263375626573020354161162254056443346423670335023336355264353717206665464516660267472101232665676251025155375410751163624622716610662455041260645101757527636411346663112547322250150416370504476430247042045413055210343574567162410317003542605246761154026040321430742105072657206314244105070210260245606227376040036220431435731056001704674777736430017332112144570226064116474400671714241224021344170213067677477772011014466726747667033533032442205154546377207272340170335077265107421777700465571722022256544227301713203705227316122766115530101747070753746672267015754457247476371436453631635050426125020244511153250641173431343175145662121506506245024615521007001201546312301020713055236406100064021302016374466542634052724074731460164470363630136115227115167430200514155371573631323101262416064262770120271401444603625577127504261257206215611446634273014135634036147753154411202676174074237706721770100004566347416410775060356457000113222241104112046501135720036720104604570770770640574424264426426640130701251366262646562235773203031113731021346765601532065720467327501033464761141503521445552756602366);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using base 8
+void
+test04()
+{
+#define TEST_WB_UWB(x) \
+ VERIFY( check_to_chars(0b##x##uwb, #x, 2) ); \
+ VERIFY( check_to_chars(-0b##x##wb, "-" #x, 2) )
+
+ TEST_WB_UWB(11);
+ TEST_WB_UWB(101001101111);
+#if __BITINT_MAXWIDTH__ >= 205
+ TEST_WB_UWB(100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100);
+#endif
+#if __BITINT_MAXWIDTH__ >= 513
+ TEST_WB_UWB(11110100111111011010100111011011111111000100101001001010110110011011010110001001000010111110011111001101101111111011110100111010000000110000000111100000101111001111010100100100010010011000011000111101101110011110111000111011001101101100110000011100110011101010011010110111011001010111011100100001100101000010010111001111100011101110001110010000111111010101011100100010011110000111010110101001001000001101001010000000010111100101001000001001101101000111011111100010110001111001110010111011000010010100101100111111);
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+ TEST_WB_UWB(111101111000110101100011000011000111101010001001111001000111101010000100100111011101101101110010000010010001101111110100100010001000100001100100110111010101110101001001010000001010010010011100010110100111101100101001011111011101101000010100110000111111011101110100100001101001101111110000100101000010000100111011100100011010100000111010011011101110001011111001010110010010111011010001011001011101111000011011011101001000111001010111110011000011010101100111010011111100011011100001101101011011000111100111011001111010101010010110011010001111101100111101001110101100111110100011101001011110010111110100101111010110001110101101100100110100001000110100111001000100001010001101000100101110001001001110111110111011010101000011111011110000100111001110101100010001101100001010001000010000000100111001011010101111010111111111110100111100101110100101000100000111110001111100010010101101011010111001110011100000110001111010101011000110000010101001010100111010110000101000100100010010101100011100110110111001001100001101000001000001001010100110011111110010010110101010110101010110000000111000101100100100111001001010111111110110010011101000011010110001000000000101001000000000100111111001111101000011111110011000001000001111101101000100000111111100100001001101010000110111111001001010110010010011010011000010001000000011110001101111010101101111010000010100101011111111110101100100110110011101100010110001100110101001010100100011011000101010001111101010101000101100000010100000110111110110100010010110110101100000000010001000101010000000110000000101000010000101100010001010001010000001100001100110110000111001001111000100010000000010101010111000001101010110111010111100010001100001111001011011101001100101110110100100000010101000000100001110111000101000011011101000110100101111100111001111100010100010111110011110000000011011011100110110001111000011111011101101100000000101111101010001101010010100111001100001110100101101011111011000100110010000000110010000110100100100000111001111110100001010000101000010011111011001010110110111010100111100000001101011011100101101000000111000001111101110101000101111100100011010011101010101101011100101101001011010000010000100110101110101001010111100000010100001111101000010000000110011010011100100100110100101000111100110000111010101010000000110110010100000001001101110001100011001011010100100100100001111001011111111111110001001011010010110100100011110011101110100000010010101000011000001011101000000101101010001111100001000000000100101001101011011100101110101010000111110101011001001001001001010111000000100101101010011100011011110111100011100100010001010100011000010000000000110111010101111001010100110101010101000001000111111001111101111001011010010101000110000010000011010011100100001011011000010010101101011000010110100111001111111111110110111011011100000100011111001110111011011110101100011101110001001011111111111010001100110111001100111011100111100000101001001011111001010011110010110010010001100110001111110010100100110110011101000011011011101011011001000001111011000010110111111111000010110011000001101110111010111110100001000111101011110100001100110111000110101111000101101000110101100110000100111111011101001100101100100110011001010110001001111001011101001010101010111101101011100000100011100010001010000001100110110001100010001110001000110101101101010000001010101010100010010000111001011110101101100010110100110010010000111111100000011100000111010100000111011110111111000000100001110001011001011011000010110101110100011010000001110110101110010110001001011001000001101000111010101101101100111111010101010110100101011111001110000010010000111010100110000000100001110010000010010001000011100000010101000110001101111000110100110010000011001111001010000111001010011010111111110100111011011010101011011100110111010100100011010100011101111000110101010111111100101101110001110101101001010101010011011101100111111110010110011001001110000110011110011111001011000001011000110011100100000010001100111100110111010000101101001100011110001010010110000110110000000100001101011000000110000100000001110010010011110111100010100010100001100011001010101010010110001001110000001111100010000010001111001101011010100101100000010000001100111010010101111000011111101100101011001000110100110011101000110001100100111011111000010101110110000000011101111110000000010101011000100110011101111000100000001110111001110111010001001000011111000111101000100111001001001111100001000011110110101000111101000100111011101011111101111000001001001101100011110000111011100011011010111001100011111101101010001101001011100110101000101100001101100011101011011001110110010101101010010011100011101101011110001010100010011001010100110010111100111100000101100110110111010101001100111110101010100001001110010111111011100011110110000110010101001011000101110000100000111101010111101000110100010100010110011101001010000110110111111101111000110000111100100111100111000100110111011000100100011111100001101000110000011000111001001101110011010001011001000110101111100011010011010111011100011111000101111000101000100101011011001111101011011111111100101000111000111110110011100111110001000010001100110010111001101011100010011001100100010101101110000011100010011010110101010110101010001100001110111110111100011100000000100100010100010001011100100111010000111000001111001101101100100010110011011010011101010101010011011001011011110110111100010010110011010101110111101001011100111100110111101111001100001011110011110111101111100001110011111111101011100101010110100000000001111101010010101000000000100100001011110010001010110011010011011000101010000001010111100111100100010110100001001101111100110011111001001101100011011010110110110111001111011010010001011101101110111011010010100001011100111001111011000000110100011100010110010100110110011010011111010100011011110111111001101010100110010110111011011000111110011101001111010011111111100101000001000100101010101001101011101000100011000110011101111111101010001011001110010000001111000011001011000011100100001010110110010101111011011111101010011110110111000011111111001101100001000011100101010111001100110101011001100100001111111110111011001100100101101001001001000100000111000011010010000000111111011010010011011101101110100110110000001100001001101100110001101010011101100110001011110011111110101001111001100111010101011111111001100101110011000110101100000100111011110100000001000111100100011001010110000011111001010100001011110011100100111000010001010000111101011010110100100001110010000011101001101011001110000100001010101000010101011110110011000111001111011000111011011111000000101010101111001101110101001000011100111010110001010010011110010101010011110111001011011001101010100001001000010111100100110000100101100000000010110011011100100110000000000000100001101011000011011110101111011101101111010100110001101010010011010101100100100101001111000001011110111001100001010010110001000100010000011000011101011100001111001011010010010111001111011000001000010010010101010000011010001100101110001010011111101100101100111100010000110111101100001111100100010011110110010001111101111010101111100101001110000001111101101001110111011011010100001111010011101010110110000110000101011011110111010101101001111111101011011010100011011010111110110010011010011100000010101100010000000011100110010001100000111001000111100100100100011110110101100100011001111111000010011000001000111001100010111000010100011001111111110101000010100100010100011110100111001001010001110111111101111010111111011000101100101001010000110101011101000100001000000110110001100010111001110101110000000111010101000000010010011000100101001001100100000101011010001110101011111111110101100010100110110110111011101010011011110000011001111110000010001100100100101100001110100110100000001000011001000110011111111110101010100011100100111101010010000101101001111101001010101010010000010101101001110111110101001101110111101110111001100111011000001101010010011001100100101110010111101001010010101001011011011001011000011110011110000000000101100011010001101010100010000001011101011010101000101010101010011010111001110011100010010000001011011100011110010000101000101010011100000101001101101110100100010010000000101000000000011111110001100110110100000001101000110001010011110000100100110001101000110000011111101010110100101000110011011111010011100111101101100101101010000010101010010010001110110100010000101001010011011100001011011110101000001101111011011110011100101111101100100010100100010000101110100000111110010000010001001110111101100100101011111010110011001110000101010000010111010100110110011010010100110011111011010001110000100011001110111000101000111010011001101100010010010110001001110101000011101010111001110111100101101110100010010010010001011110001110001010110101100101011000000001011100101000101101111001000110010001111111110110100100100100110011100101111101000110011110101010000000111101010100001110011111110110110100100111110101011010001010000100100001110111010001001110111011010111111011100001000001110100111111111010011100101010011000101110000000111100101001100110001101100110010010001000001111010000110101001011011101100101010010011111010000110010100010111011100000000011111100010010000011000110100010101011111000000110111010101001111010101111001110001011101000010110101100111000011001000011011000101011001110101000010011010001000110011011100101110000010100111111001101110001010101111110101111111001000001011001010100011010111100001000011010010101110111001001111110111001001000010111001110001101111011010011011110100001111010000101110101101101111110001010010101110101000000011001011011001110010100010111001001011111111001100001010011000100011011101110001011010110100001100110111001111001101011001011101100000011100110101011000111100100001111100101111111010100001010011010001100110110000010101010110101101100100000101000101010101001011110010010100100100110001111100001110011111101110110001000100101010100010111011111101000100010110111001100001000111100000100001001001101111010000111111110001011111110100001101110111101101011000000011111000011111110011100010111111010110111010001001101101101110011010110001000101010101111000101001010100011100001110100111001110101000111101100000001000101000001111100011100100001110001101001111000010011011110011111101000101111101000110011011111010000001010001001100010000000101110100001111100111001011000101101101000111110100111010001011110101000000111001100010010001100111011100100001000001101011000100010100010100000101001101000110011101011110101010110000100011101101111000110111000100101110001011100100001110101011000001111111101011000110100000001001000000111001101011001001011010010001100011010100000110101110111011110111110110100000010111111001000001011010001001000011111111101110010000110000000111110100100110010100101110011100101000010011001001001101101110110011110001100000100011110110110001111111100111011101000100011111101011110001010101001011010111000110011110110101000111001010111100111011101010000000110111101110001110001011001000110001011010111100100100100101000000100000101111101111111101001011010111110100010100001011111000011000010101000111111110001111100010011101000001100011110111110100000011010110001001111100001100001001100000111010100010010101110101001100011101100000111011010111011110110010110010111100100111001100001000111100110001101100000011001101101101110010110101000111111111110100110010000100000100010100000111011001000110011011000101101010001100111001010010011011111001100011101001001111001010111010111001111101010000110010110110101000010010001010110000111100010000010000100100101000100110110100110110101100001111101000101011100101101100111000011010110111110100011100101111010101110101100100110000010110001000001010110111001100001101110010000111001000100100101101101110110100010011100010001011010111111001001011001000110111101110101011001110001110001101101010111110101110110001101100011111001010110001010001000100110101010010000110101010110011111010111000010101101111011100000011011110111111110011011100001110110010011101101100101111101101000001000110011100100000100111100001101110100001101000101001111001100011110110111010111001100111111101111101011001010011010110100010111110011010001000110011011011000100111010001010110100010100001111000011100001001010101110110101110010100000100111101110101101110100011110100100101101001010000010101000000010111101011100110101111000011001100101110111100101100101111100110001001000100101010001011110101111011100110110001111001011100111111111010100010000100100000011010110000011100111110101001111001000111100000010000100100100101101001110101111011000101101010111100010000001101100100111100100000001100000111111110110101111111101011100100111100000101000100010001010001101010010110011101100000101001111011011010001110010011010110100000000110001100000110001100001010111001101100011000000101101100011011111100110100010000101011000001101010100001110000101110011010100000110101100111101100000000011000100000011101000011000110111010110010010000111111110111110100100101110111100101100101001100111001101000100101001001000000000000111101001011000010100111111000100110001110000101000101010001111001110011000111011010110101110010000100100100110101100010001000011001101111001001110011111111001010100110101010001111101011111100000011110111111111000011111000000111101100001111000001100011100010011010110001111011000000011001100111001011101011000011111010101101001111110000010100000010010000100110011101011101111110100101100111011111011010111000001001001100111111101011111000000100111101010001000011101010100001110110100111101100011111001110000111001011011011010111100110111110101011010011000000010010110100000110101101111000010000101001010010000010111010101011010110011110110101111111011110010010011110111001000111101000001001100111111101101011111010001111100100111110110110001001010001001100010011010000101010001010011111000100001000111100001000011010011000111101011111101000001011100011000101011010011101001001001010001011011001110011111010110010000110101001011000100010110011000101110011111111100100001011110110001001011101010101011100100101111100011011110111010010101110011000101111110000110111111010110011110000011101101001010011111101110010101110100110001101010000111100111101100111101100000010010110101100110000000011110111101001000011011010110101110110000011100100111000111001000011100001100010010000001010001111101000011101000010010000100011000111011110100111000101110111000011000100001001101101010010100011001001110000000000001110010010110111111101110001000001101011001101010001100110101100001100100010101001100100100010011001101101100101111111010000101111100010001000001101110111000100011100010101110111000111011100111010011101010011011101111000011001000101011001101010001000100110010111010110000000000010000000000001110110101101011111110011000010111010001100001101101101010101001000000110011100010011100010110000010011001100010101000000011111001011111000001101111110000110100011011001111111110011110001011111100010010101001111100110011101011111000101111000110010110101100000000111000100010001100111110110001110100110101011001101000001110101000100010101110110011011100101101110010001101111111111110111100101011100000000110000110000111010011110110100000100001001111110101000011101011001000001001111100100111010111111111100001111110100100101111010101011010100111000000110100111001101001110000100001101000011110110010110111000111010100110010101001101011000011100000001001100110000011000000011111000011001110111100001110100110100010010011111111101100111011100000000111000010000101000111001111110001101010000011100110111010110001100000000001101010011001000111011001100010011011110111100111111111111001000011101100011111111001000001101011101101110100111101101001100111111100010111110000000010000110010100101001000100001001011000111101111100111000111011010010000001001011111101100101010011010110000111111001010100101000101010110001011000101001111111101001000000101110011101011101100000001100110000010010101111000111011010111011111110000100011110111101001110001010010110101101000011001101110001100000001111101110011101110100100001000110111110010111100011111001011000000011011010101110100100111111110100111001001000011000001111110001000111111111110010110110010101111001011111110001110101000001100000110101000011010011110100000000010111101000001001010001101011100001011001111101101010101011100100100001100011011111100110010100100010101110110100100101111000011010000010010101010110110011011110111101011011100010111110010100100110101111001000101101001000101111010111001110011011110110100100001001001001000010111010011001001000100001100111111111101100100110110110001011101111101100011100101100110100111101100110100111010001110001101000001011001111000100101100100001011000110001111101000111110101111101110110001110000011100011110011011111101011010000101101011101000000110010011010001110110010101010010010000001001000101011111011111101010000010011001101100111101100110100100000101000000101011010110011110111100111010000010001011101110111111001100010110100110010000100001111011111110010010111101011010101100111000010101011010000110010001111101111101000010010001101110101001101010101001000000100100000110011100001101111001010000101111010001101001100001101101011100101111011000001111101110100101000101011000000000010110100111111101101001110111101100000000100011100101101111101111110010000101011100010101101010100111011111100110100100001001110100010001111011111100111010000111110001001010111110011101011011011110110000001000000111010110101100001111101100011101001111101101100011111000101111011011011110011100100010000101000010110110101110000101100100000011110100000110110010010010110001011000110110101111110010100101111101110110101111001011010110011101010100101110011111000110001011011011100000010110110100000011010010101010000000000101100000010010110011110011110000100101011011100100010001010000100000110011010111111010000011001000101011011110001010110001101100010000100100011101101101100000101011001000101001010100010111010011111011101000110111011110000000110011001111000111000010111111000100101110101000001011001001010000000001100100010101001010101111000111111000110010110100110100110111111010100001010010111110111110011111010111111111100010110000001110011110011111100011001001011110101100000011111101011000011111011001101110101001011010001010000001000011111100110011110111110101100001111011111100011100111001001111101100110001100011011111010011011101110111011011000001010000101010011110010010110000100010011100110011000000110100011010000101100111001011010110011000100111011110101001111000111110001100110101000011000001101011110011010101011001010111010100000110001011010110010000001110101011111101101111101001010000000001100000010000000100000011110001001001010110010111000011011011010011001010001001001101010001010010001101011000101101011111101000000010100101111110011111011111010101000110011101001011010011010110101110101101011011101010011110111011011101110111000010100011011101010111010001001101111111000011101000110101000000110001000010000110011011011100010101000100101110100010000100001001101101001110011101100011010110000011011001011101111100101011110000001110111011100111010011110001011110001101000110000110101011101100000011101100011100010011010001110010000011100111011111000001011111000100011101011000101111110011000000000100110100010000101111001001011110001100111110000110101001111001010000001010000100000110010000101111100101000110111000111111101110001101111000111000001011010000101101011001101111110101010111100000011000010011100010010011011010011001000111101000001001111000001110011110100111010011000100110101100000110001110111111000101111001010111110001000101101110011100111011010010011111010010001100101011010011001010100011000101101101010001111010001110001110000100011010000100001101001110011011101100111110010101000000101010101000010001110100100100111010000011001100101000011010100000100100101001000100100001101111101111000000101000100001101011110010110010101010100110010101101000111000010001000101111111000001010001111010011111011000101110010000010011001000110111000100010000110000010111001110000101111001011011000001001010000010001000100100001010001001100010110101001101101101010001100000101010000001011011011001100011100111010000000011100111010101010111010001001110011000000011001010111000110000100010100001111101011101000110000110011110101110101010110111010001011001011111001010110111110100011000010001110110101011110101100111100001011001011110000010010110111011100100001110000011110100011100100000010111100111101000001110010000011001010010011011010100100110101011101000010001101110100000101001101101000001111010011011110010100000101001010000101000000110010110110100000010110100101011000011010001100011001010100001110000010111110111000010101100010110011010101010101010001111010001010100100001010010010111011010011111111011000010100001010101101010100010001111101000010110010010000100100100000010011101000011101001000010011010010101001111101110100100001100001011010011100010110110111011110010101001110001010010011000111000011101000101000010110111101011001001100111111011010001111111100000111111001101111000000010011100100111010001101111010101100111001010011000001100001101001000100001010111100100000011110010100010010111011100111100000100001101011010101100011110001011110001110111001000111000111001111111001011011110010011110001001110101101011110011000010110110101100100110001001101111101011101110100101011101010000111011000101000100010010010000101100000011110011000000010000100100010001011001111011001110100000101001000100110010111111000110000100000011111000000010111010110101100111001111110000000000010100001111100000100100011011100011011111101000010111101011111001011010110111111010001101110100110011001011100011011001110111110100011001101010011001010010011111000110111010001100100101000011110001110111110000101110011101001101110111011001000010010111101011001010100101001011110000110101001001111111001110111100011010101101110101110001001001001100001011110100010010011000011110101000000110011010001111001000010010101010111001001111101110011000111000011111100000010110001011110100100100110110001110110100101011101001010000001011011000101001000001011110111000011001000011110101010110011100101010110101000001010111100010000000011001010101010010111000100011110111100001010000110001010111000101100001111110000100000101101001110000100010110111000111101110100100111110000110010111110000101111000011111111011000100111001111001100111001110111011011110101010100101110101010100010001011111101101111010011110001011010001110011011110001001010001101100011111000001001000111010100100001100111010010010001110010101010100001101101011101111010111110110100010100110100100011001100110110000001000011011101100111110010110110110101101100000010101100001000001001110010111110100011011000000000010011000010111011111100101000110101000110001101111111101101101100101101001101100011000111011011000010110100101101111111110010111100100011101001101101001011111110101010100111111101100000011001011101010010001011011100111000100011001110111010110111010110010001000100110001010010100000101001001000111011010011000010100111100001100100110011111011100100000111010001100110000010111101010101000101111110000000100110100111010011111101011000100101110000011100010001110000011001100101010000011011001101001101000111100100111001100101010110001111100010100110110000110110001101100000111110101001101100011001110000010001101000000101100011101110000011111101110011010101011010010011011001001101001110010001110010010000011110101110001011111011001000011001000111100011001000100001100110010011010100101000001111001011001110101011101000100101111111000011110111001000001011111100010111101100000110111011100011011110110110010100010111110100110100100000110100111100011101111110011101101001100111011010101010100011101000000111011101010101001010000100010100100101011011001010110100100010110000111101101110001001111101101100101101011111101011010001111001101011110000111110110110101101101111111110011000011101000100001110010011001000010101111101111011000001101011111101011000011011111000010111110000111110110100000111100001011011101101101110100111111010000110011100011001001101110100111000010110001011010010101000010000110100100110101100100111000100010001111111001000010110000011111001110000011110000100110000110100110011110100100101011100000010001011011000011010001110000101010100001001010010110000110001100111011001101111001001111010101011101100000001111101110010111011000001011011111101000010110110001001011100000011011000100111110110110101100110100101111001001110001011101111001111001110000100101000010101100100101011101101101110010101111100001010011011001100001111100010110101101110100001100110110100100010000011100001001110110110001010010011100011111101000000010101010111110011100000011000111000111101010100111111100000110101000001101001010000100110100100111110001110000010010110011011011100000110111100100000101100111011101000011111111010011001011001010001111010100011001110011100000011010100110101010110100010100110110101101100011001100110100011000110100011110001011101100111010010001001101001101001010101101101000100001110011101001111101111000100101110100000110110101101101101001011111100110010001011110111111101100101111000010111001101001101110011010111100010000111111100100001110111100011011100101101101000011000000110101110000000000110001110101111011100010101011110100001100100011011101000001101111111000000110101010101011001110001101101110011101000101110100100010100100001110100100011111011110110111010010101011000100000101011100011111110000011110000111000011110101000100010111001011011100010010001100100001100000000000110111000101001100101100011011110111111110110100011000011010101110110101100010010011011101010010000001011111011001000001000000001101101011000111101010011101000001010100000011011001101101101100100100011001011010010111000111011110001111010101101100111000010011101101010001110001111000000011011011001110010111100001101111010101110111100001110110001010011100001101100010101010111011011011101100010110010110011100111001011100001100100101100111010001000000100100011011011100111000101101100101001110010111011101101101110011110111101011000101000101101110110100010111011000000010101100010011000001110000010101100100001001000110000000001101000110000001110001100010000111111100111110010011010000101011011110011100001110101110101001011100011110011000000110101100010001010001011010000001001001000111001000000100100001001001010001000101011100010100110101101110111011110010011100111101000011011110110011110000010100101111110111000000001011110110100111011010011110011000010001111001011110001100000010011111101100110011010110011001001001110101101011100110111100011101111110110010101100011000100000010010001000010111000001100100100011000001011000110110111101100001000101101010000010111110010110001110010011011110011110000110111101110100111100001001001110101110111010000110000101001100110111000000001110110100000110110011110100011111111110000010001101010101001000001110101111101001000100101111011011001111100110110111001111100100001100000010010000101011011101001100111100110011111000000101010110010100011100010110001010100111100001101011010100110111001000011110010101000010000110001111101110111000101111101110111101101000001011110010011001111100110111010001111001001100000011110010000010111100110010100001000110001000010101101110001100001101101111100011101001001001101110101100110001100100100100001111110100010110001110010001110000011001001101111110100100101011010101110000011000000010110110110010101010011001001011000001111100101011010101110111011010011101110111011111111101101111111010111100101000000111111010001101011011000000101101110100110010011101001001101010010100111101110010100110100101010010011110111111010101101101110011111000011101110110010111101011001101001000111101011010000110110010000111111000010111000101110110001101000100011010111011101000000001000100000011101011110100100010110001110011100111111101110011010010110000000010111010000000100100110010100010011011111111000011011100011000001100001110000101100000011000010000101110100110111000110000000011100011110000100001101101011001011100011110100000000000101000010010001100011001000010111111011110111001011001100011001001010000010001000111011100010111001000100101111111010100000110001010101011110000110110111001001111110110000111011010011000100010001010011010000101101000110011101100101111001101101000001010111101111011101010111000111100100100111001001000101011001111101000110101001101000110100001011111010001001011010001000000111110001010111101100110101001001110110000001000010101101111111100011111111010011011010111001110001010101011111110000100111001100000111110110000101001001000000110111100101001001001100001110001111101110001101011010010000111000010011011100001110101010001001000010110110101100101001110011110000010111111100010000110111010101100001001110110010101111101101101000010110001110010000000001000000000101001100111001000010001000101010011001000000000011000111100111100110101101100101000110111000000010000010000011110111011100010000100001111001100101001101011001101000101001001000011000001100010001011100010000100111100001100011101100101011101011111101000011010001011111000111111001110000011110100100011000111110011110111001100010000010010001011001000010101010111000101011101100010101001101110000000001010000010000101110000001100110011101101101110000111101100001010001011101000111101011100011100000101000010100001110011110001100011110011110100000001000010111000101000111000100010010110101100110010100011000011000101000010001010100101000001101110001000100110001010111011110000000100101100011010101010110101111111110001101001001001010100110111110010100100001111001010010111010101000110110100101101100010110010000001000000110010111100010011101010000101101000111001100001000001100011100001111100010001101111100111111011101101010101101011010000100000011101011010101011000010011010001000011111110101000011100000000111101010000100011101110001100011100100010011111111100111100000001010000011000110110010101010010010111000000111110111101011000011110011100010010010111001001011001101001010101110110000100010010110001000100100101011010011110000001100111110110000011010111110011110111111100111111110000000101001110110010010010100111001111110011101000111101010100010001010001110000010110100110110010010110001011000001000100010101110000100000100011010011011111111011001101110100100001111101110011011110010110101010001001010000110111010111011000111111100010000101101100100111011100111100110010010111001101000011101100010100001011010100011010010100101101001010101101111000110011110111110010101111111000001001000010010011101100101000110101111110010011111100100111100111000011111000000011100100101000100111011100000010001101001000111010010100011101010001001100100100001011001001001110011100000111111000111010011011010000011001111010000100010100000111000101000011011000111000010100010010001101010100010100000101001011011010101101100101110001110001000101110001111000001011011000111110010000100100101000111100111101100010110000000010110010110000000010001111010101001110011010010011110011110010111001000000000000100101010000110000000110100011110011011110000000010100001101000100011101100000100000010111101011111100001011101110101001000011000000101101100101010000100111001111001101100101110011110011000100011011001100101001110101100110000111010011011110000010101100101010110101101110100011011110111100010100000010100011110100101101000100101011011010001011110001111100101010000011001010010010001111010011100100110110000011001000101010001101101111100100000111101011000111001001111100100110111001101100110110011110011001111110011111000010001100000001100111001000010111100101101100110011001000101100001100101101100001110011100111000000111011100110010001001010110000101111110100001101101111111111100101011001101101010111101110000101111010101101011011110111001110011110010100000100110111110110101111011001111111000011110101100111010000010000101001000101010000100010101100100101011101110100000100011101110111110101000001011101101101110100110110101000100001110110101111011001001001001001100010111010100110001110000111111111000110000100011011011100000100111111000110001001101001000010111110001111001100101001100100111100000101110111101010111011000000101011101100101101100000010011010110000010001000111010001100101111000000111011101000111100011100001100101001000111111000100110010010111111010000011110000001110011111111111111011100100001001110010101110111111101001001010100100001001111000101011111111101011101000000101011011011011110111011111111011010110101001011001110001011001011001101101001010011001001100101011000011111111000011011011101101110100111111011011111100011100001110111001001010010100101011001100000010011000101111000010000001100101101101001001101001010010010101111011000110010100100010111011011000000000111000101101011110001000011001011011010001110111001010101110100001001110010011010010000100111000101110110000111010010011110010100011111001001101100110010100111111000101001011001101101011100101111011100011110110111011010111001110011110000011111001000010011110011111100000100110100011010011010110111110100000111010001111101000111010110111111101110001000110100011010011111101100101110001100110100101101000110110011111010001111101100000100010011000001001000000110011110000010110000000110111001001111000011110010100101010110111100111001000101100101000110100111010110101011000110010010100001101111011111010001111100010101100000001011101111001100001100000010010001111010100101100001110101100010000001010111010101011111101110110000000001011110011010000110101111101000101000111010010001011010010011110000001110101100011011010101001110001000001100001110100010011000101110010100010110100100100111001100001000001011011110111101100110001010111101011000000010011001001110000100000011101011011110111001110101111111101111001100000101100001010000110011000000001100000100011111101110101000100001101011111111101010111110111011100011000110100000011010110110110111001101001110100011101000001100101110010010011101010000101100000001110110001011100101000110010000110111001000011001100011101011110011000111110110010000100100000100110110101100110111001001001100111001001101011001010010010111011111000100011100100100100010101100000010010100100011010010110010000111111010100110110010001100111101010100101101011100100011000111001001111111000011101001110100000101011111111100101100011100001000000111100110001001111001101110101001000000000110010100010000001001100111101100100110011001110000110000100101000010100010111001110011001101101100011110100011101010111111011110100010011001111110001000010111001001110000001100110111000001101010010000101111011111011110011001000101100011101100001000010101110000001111111001010011000101010100101100000010000000111001110000110000010111000011110010101001110010100100001101010011001001010101010001000110111011110101111100000111000000100101010011000111101110111111010100011001000010101010011010010111011011111111000100100111000100000011011001100111000000110011000100111111011101110001010000010011010000011101111000100100000100001111001001000101011000001000111001101110110101100100100100101111001000011010011101011011001010000001110011101010101011110101001011101001010111000111111101001000101100010101110010011111100000011100111001001000110010111011010000000000011101111000110101111010100101110010000011111101001100010100110110100010111011100100010100011110111011101000101000010100001001000100110010011100100100100010010010101100010111010110001101011011100111000101011100011010001010101001111001001010011000011010100010011111101011110001010011101100100010010101100011101011010010111001010100101000100001101011101110111011100100101010011110100101010100010100001000000011110100011111110011111001001011011011001100101100111010101001000000100011001110011110011001001111100101101010110001111011101011110110001111111101011011101111001110110001000101111010010101011010111100010011001001000000110110011110010010011000101100111010001001001111110100010100001000101001001001001111010001111101000110110001010000010100000111001001001110011001110101001101001101100101110100000100010000001110011111000101011001111110111110100110100100010001010111110101011110101110011110000000011001100001000101000001100110011011000001111010111011000110000010011111111110100011011000101111001011110010011100111000100001010010101111111111011101000011010000111101010100101110100111010001110110011100101010100010000000011110100011111111000111010101000001110110010001101101100001110100011001010111101110011101011100010000110001000000001101110001100101100101011110100100100111101000000101000001001110000011111100100101110101101101101100100110100000111001011110100111111000100100101001100100110111011011100101101110001001101101110011101011000111010110011010111001101000100101010110010001101100000111010000111101011111001111000000101000101111001011100101101101111011110101100111000000111000100111001100101101010100010111001100110000111010101010101001010100100111001111011110001110010101011100101010000011101100001101001111001000111000001011011111010110111001011000110110110111001000111010100000110110110010001110110000110010110010111101001010010000110101101000010110101000000001010101101001100001110010010100001101010111001101110110111110101110001111000111001100001000001101011101111110111001010011000100100111010011001000011011011000001010110111000000000001110000000101110010110100110010101101111011110011001011011000001000101001100010011110011001100110111001010111000000100111101001010111001000110111110100100101011101010000110110111010101001101000101101101000010001101101111100101001011100100010011101101111110111101001111000000011000100001010011100000111011100000110001110111100110000110100011101011001100111000101100010101110111001010010111001110101100111000011011111111010100001010111111001001100110010111010001111101110011001100000110000110101000011000111001011111110011001110010011001010101011100110010110011100110010001111111001101000010110101101100001001010100110111001110111100000110111111001010111101110010110101111011010010101000010111010111000100110000011110010010101001001011111111010000010110111110001111100111110101011100100000110011011101011101011001100110101100000000001010011001110001100010000100010001001011010100001010010010110001010011011111010011110001010100000010111000101010011010100111110101000011011101110100100010000111110101111010110110001110011001001000111011111101000101110011000110111000000001101001101111101000100100100011110111111000001001100010011001010011001101100111000110011111110010001101010001001001011010000000100010110101000000110110101010011100110000100101100011100111111100010000000100010001101110001101110001101011111110110001011110001101000100000101000110100011011011011010110101111101100011010100011100111011100011111010001010100000001100000000001100110001000111001111101011010100010000101000110111110001111010100011000001111011010001101001011001010000001100110100110111101000011000011011001100011011111101111100111110100111010011101111111100000010110010100000011010011101010110110111110010011101101100001101110100010100000100101010111011001010010111100011010100000011011110010010000101010111111100100110010110011101101100111100011110111111110000110101010110011010011111111110100001111101101011101010010011011110011110001000101000111011000100010010011011000101111000001010110001110011101110100000100001101001011000101001100010100010000011011010010001110110101011110101000001010010001000001001111100010110110101101101010111001010001110011011000111010000001010111111010010011101000001110001000010001011111010011011011101000010111010101101100100011100000110110001011010100100010111000101100110011101110101110101010100100100100011000010010101101001100000001111100101101000111010100110101110111011001101001011110010101100100001111001101010010001110111101111011100010110111101110011111010000001000111100001100100111111001100010000011110010101110011010100000101011001001001010110100111110010000000110010101110111110100110100100110011010110111010010001100001010110111101000101101001010000010001000101111011110011111100101001010111110001101011111101100101110000101111000110101011101101111111110011101010010100011100000100011000001000101001000011100000001110100000000010111100111111000101010100011010010111101111011101100101101011010001111011011010011010010010110110100001000011101011100100011000010000000111100011101010010111111010110110011100100111001100011000001000001101100111000101101111100110010000111011011101010111010110000001011001001001001010110111100010101101001000011000011000111010110000110101100111011010100110010010000101001101011011110010001110000011011110111001000110010011110010111101101011100010010001111100001010101000101101001000110010100101111010100100000000101111111010110101100110010011010111101111100110101011100100111111110110001011011011101001011001011011100010001110000111000101101100001101001111110100101110101001010110001101101111001010010000001011011100110000100111101100100111000101111011011101101001101110010001001011011011010101011100110000101111011100000111111110011010101101001011101110110011001111011001001110010110001101101010010101000010011011111010011100101010101111010011110000101011001101001101001100101011001100011011010011111111010010010101110011101001011000000010100100100010000001111111011010111011101101000111110100110001011001000101001110000101111000010011000100000110101010110100100110101101101011001010100100100010000111100010011010110111111001100010110000000110101110010011111000010101100001001101001100010100101101101010010101110110001100011001101001111111111001111001000011011001101011000110101111101000100110101110001000110100100000101101110011010101011110110001111011100000001010000000011100100110100101000000010001101000001100110001110010100111101010110111101111111100110100101101001111010011010011011011100100011101010111101010101110010001000101110100001000101111010010111110111111100110010000110101100010111111001000000010010000101010011101000101110101111001100101010110010101010101010110000000110111100011101110010001010110100011000110111110111000011000100100011010010100100011011110100011010100101010001000011011010011101001001000000011110001001001011000000101101110101100000011111001101111111010011001011011001110111111110001011100001101110010111101011110001000010100110010011010010110000011001100000011100000110111110110110111100010100110000011111100001011110010001011011001000101111110001010110010010101011010000101111001001101001011011111000001100111010010010111010110100111111101000010000000110101010100000011000111100011100000001000101101111101001101010100010000110100000010110111011101011011110000111010101001101101110001111111001111100110010000001011010011001100000010001010110111111001011111010110111011001101111100110111100011100000011001111000101111011000101011011000110000101001101000000100100001111111110000100100111011001001010000010000011011011010100011110001011101010001001111111101110110010010001000111111000001111101101011100001110010010010011110111110011101000100000100001000000111111111110100110001001110100010011001101111111110111111101110111110010011011001011011010111101100100001011111000111110100001110101000110010110111000110101100001100001011101000010000101011000100001100010010100011010111110100110011101010110110101001011010010001100110001011101110010010000111011011100011011001101011011010010010110100110100010100001100111111010111100000111110111010000111001100010000011001101110110000101101000110110101011101101101101010100001110110101001111101110011000101101001100010111100110100111000110100010101001010000011000110011011001010110001110110111000100010010111000000110100000110110100000110101000001001110110110010010110110111101011001001110000111110110001100011101100001100111100001001100011010100001000111111010101001001000001000110011101011110010000100100101001100111100110110001110001100101000010100000000100011001110010100110011111100101101000101111111010000001001100001000000001011101111111110010101011110000001011001000011011001101010010110101101000110100011001111101101001111010111010000100000000101101001101010001000001010011111001110100011111111110000000001111111001111100100111100111001001100111101000010000010001001010100010011100000000110111000100101111010000001000001111011000000000110010111010000110111001110111010000010010101100011110011110010100100111000111001001000000101101101110010100010111110011110011101010010111100000000110011100111011011101000000111110010111001111101111101011101010011000010111010111000111000101100011100101000000111010010001111011101100111001011010110011101110000001110001101110011010000000100100101111001011110110011000100010111010110010010001000010011111011001011011110011010001001000101110110111001011011110111010010000010110111011001011101101111111100101010110010101100110000010001010110101011010100011001101110000101100001101000000001011101101111101101011101110001111010111000001000011001101111110000000001111011010010101110111000110000111000000010011011000101000101100100010010111011010100111010011000010000010110010101001101100100101010001100110011011111010001001101100110010001001001110000010001111010111011001110001111010110111111010011111100100010001011010101000111111111111100101111010000101101100000000000100110110000110001100110011100011101101011011100100111101111000110110101011001000001000000101111111010101101111110100101110110100011110111101100010010111001011001010000000111001110111100110100111010001001100001001100000010010110000110111111100000101001001101101110000010110011111010110011001001000110010101000101110010110011110001011010001100100100001110110100010011101011110001111101011010000100100101111010010001001110100011011101001011010010110100011101010001100111011011101010011010001011111000010010111111101010110110001101110010100110001001011011101111101001001010010010100101100001100101100010001000011100000010000010011100001000001010000100010101101111011100011111000111100100001111110101110100110101110000011111100010100111100111010100111011000100100000100011111100010011000111101100000110011111011011011100010101111101011000010111000110010111011101111000110010100101111000001001011101110000000011000111101000111001110101011110010010110000111101001101010101100010111001001111010000100111101000000010010100100101101000110110000000110011001101000111011101010011100100001110011100110111001110100000101010111011100111100111010100101101000011001100100111100001101011001111000010110001100100101111111111100011101010010010101010010100100110111010100001110001101100101000010000111010100001000010100011001101000011000111010110111100001001001001110001000001101110010101100011110000101100001011111000001110011000001000101001001101111111110001111000010010110101010110010010011100111110011111101010010110000110000000100100111001111110010011111000111101000111101001101000100010111010111010001100000110110010011001000010101110011100010010011111011001100000000111100010010000100000110001010111101001000000110110001100011111000010101100100110011011001000010001000011000010000010011101001011101000100110111000100010100000011011100111110101011011101111101101001010100100111101111111001101111100101010111110101001010001010011010110000011111100101101111011001001000001101011000001011101101010100010010100011101111100101110111100001101011101001000101010000001111100010110101001100000110101110010101110011000010001101011011101011010011100100100100011010011001011101001000111011101010011000011100100001010101000010000010011100011111010100010110110101100101100001100100100110000110110101100111011000011000000000011011000110101111100011010101010101011110010100010111000111001101101000000010100110110011110010101110001011011010101000011011011101011111101110010110001101110110001001111110101000101011010100000101100111000011010100000100110010110111011000010010110010010101010101110000000110010010011010010110110100110101000001000111010110011010011100101001001001001001100110011111000011100011010010100101010110000101110001110111110001000111010011111111111010000111111001011101110001101010001110011110011110101111100000000010001000010010001100000111100001011101111010100100011100000011100001110101110011110011010101100011110000001001101101111000001000100100101000110001001100000010111111111001010011010101010011011000001010000000010110111110000100100010110001010100000101010101000110110110100110001101101010100011101011111111100111110110110111001111111110111110101100010010101100000101101101011100110000011011100000111100011011011110101011011110011111001101011100001011111101000010000100100101000110110101110011010110000101010110001101011101111101000110011010100110111110101110001111000011100100000001011111111101011111100111000110111101001001101100010001010001011111000111000101111111001010110000010011011000011000011110010100110100000001101111011001101001111100001011011001001111101010110110111010110001000000011010010100010010100101100111110000011000011110110011011011011001100101100101010000011010100110101100101010100001000010010101011001100110110011000001101011010001000010001110001100111000100001011000100011010111011111111111100110000001010001001110010010000100101111001010110110011101011100111001011101001111110101110101111000001111001011101010101101001111001111111001010100011010101101111000001011000101100100100010010001111011000010010110111001000110001011111010100010111111011101001010111010111100001111011101101011010100011001101110111101110111011100000100010111100100100110010010010000010010111011000111100101000010000011110101101100000001110011111110100100000100110001100010010110011011000110010110001111100001001110011110010010110111010010110001100000010100101011010000101111001010110011111110001001000001011110111010110000111011110000000111101011100000011011001100101111000110110010011001100101100101000000011001001110010001011100111101010000000010011011110101111101101110011101111000001011011001011010101010000011001011000100000111100111101000001100101011010001111000001100111011101010111010110011000110000001011000101000000111001100010100101010011111010110110111010010111010110000100010000100000001011101000011110111011111010011111001000110101011001000011101000000000000101100011111101011111001111001000110010001000100011001011001001111001000011001110010011000010010000110010101000111011100001111110010000000001001101111110110010111010111011101111010110100111100011101001001000010100110100011000101010110001001111000100100000110000010010010011011100001111001101011011101000011111011111111000111100011100010000010001001110111000100000001011100110110101111000100011001110000000011111011001110110100100110111001110111011110011110110111110111101011000100001000000101110000101001011111000000111001000111111001010001100010100101011000011110011000011100000010100000010110010111101110001111001010001001111010011010000010011000001100101001100101001110001001110010101000011000110101100011100000111111110100101010001000010101101000001010011011010011101110110010011110011100101011000010011001011101001110111010110101001000100110100101100100110000000011111010111001010000101101110001101001000000100100101100111110000101111011011011010011001011000000011011100110111100010110100001110110010011110111010010111010011001100100010010000010101100100101100001011001110101011010001111010011100010010010010000011001010100000100000000010010000010101011010101010000100001000100000001110111100111101111011100110010110111110111110100010001010110011010100001011111010001011001100100011011111011111110011011111110001111001110111110101100110110000001100111001000101111000110101100111110011111100100110111010110101011011010100000010010100100111010101001000011001110100110111000001110110011001010100110100100001111111110011010111011000101000011110000010010101111100110110000101011001111110000000100000101011101011100101111000110011001010111011010100111101100101001111101011110010001001001111001101001111111000100111011110100010101010011110000010111000101001011110010000010000110101110001111001010101100101100011101010001001101101011010111111001111100011110011000000011001011111111111101100010001111100110011101010001100111000110100000011100110011110100100110010010100111010110001110111010011010101011101010000111011101100101101101001101101110010111111101010110101000111010010000001001000101000110011011001010110101101001010111111010010111010001111111101111010110110100101011100100010001111000001100110101011010100110010011110011011000110000110001100101110111110110000001101000011011111111001101010000011010110011100111001110001110001001101101001011111101110101110110011011110111101110011001001010010111010100101110110011110001010011010101101010001001101010000001110100100000101100001101011111011011001001111011110010011110000011110111111011101000010010100010010101011010110101010110101110110010011000100000110001111001001000011011111111101110011000000100100111000100011100000100000111010111100101001011100101000101011110001010001101001010011010011001100101100111010011110010100010010100110000001110111011011001010010001110000110111011100101001000010111010100011011110011100110011111001010100100111001111110100001010001010000001100111100011111101100011011000100101101000101011001101111111101110110111110110000111110011110110101101110101100100010001110110111000000111011010000111110100100111010000101001010010001111010001011111001001100010110101111101100001101100000000100001010111001000010000101100110000100001011010110101110101011111101001010001000000100001111101011011001100100011010110101011100011110011001001000000010101111011100101001101110111110101001100111010110110101110000100000010111011101111000000110011100011000011101110001100011001111001010101010010000001100101011111100011001010000100001010110110001011000101000111111110100110100110010110101001001011101010001001010010011110100011110100011100010011011001011010101010111010000011100110100100100001101110101011000011010110010100110001000001010110011101010100011011011010001010000001100100000101111111100010100110100011101111111100010110110110000100010001101100011000000001100001110011011010010111010101000100100010110000111000110010001011011101001011100111101100111101110110000010100110000010100000110110110010100000011011111100110111011111010110100110000110111101110011011010010010101100001011111100100111001100000101001010000100110101111011101110101101110100111101100000101000111110100100000001011001000010110010101101101000000000001001001110011111011011100111110001101101001100010110010110101010110010110101101001011001011011000010101001100110111000110010000110001000010000011011100101110111010101101000001110000001100000110001011011010101000110011010100101011111011110001011011001110110100000001001111010000010001011010000010101111111001000001011100000001010111010011010110011100111101000011010011010010000000001000001000111110011010111001101111111101101101000000110010111101001111001110111001101001110011100001101100111000100100001110011111010001111011100001100110011011100000111010110011101000101000001101010111110000001000110011001011010001111100010010001011011001001010001110011001010101100010000110001101001110011000100101100011000101110111000111011111011011111001010111110011101111100110101000110101100010011000011100100111000010111011011100100111101100101101100110000100110010110111010100001011110100011011110101111010111010011101000001101000110100110101001100111011010100001010011001111100110100011100010100101101110010101111011011001111001101001111000011110110101110100111101011010100100011111001011100011111100010101000010010111010000000110101100000001110111100101000000100101110111010011101111001101001100001001111110000001010001100010111100110010001000011001001011110101001000000100011010100010000011001111110111010011001110110011001011011010111111001111001111100000110101010010101001000011011001110111110110000101001100111100000111111011110000101110111010101100111101110110000101110111011100111010100000000001101000111011111010101110000001011110001001100100001000111010101110100001101101001110001110000001100100001101000001101100001111111001001000011011010110001110111101111111010101001100101011110111101101001000011101110110001111010001000110111000110000111001001000001110000011111011110000001110110000001110000100001000110011110010111010000110010010110110001010001001000010000010010111001001100100101011011110010111111111110110010110111111101010010011101000101110000000000111110110101011001110111111100110100010010011001100100100000101010010111001001110001001100010001010000011111010110011111100010000111000000001011111101101010110110100101110100000010011011100111010101100111011110010100111100111101100000010011100000111001000001011010011001111111111100010011011111101100001101000101100101111110001001100110011101011100010101111111111100001001000011000000110111101110011100110101110000111110101000111111001000111000100101011001101110100011100011111111000000000111000000001010000010000000001010010100100101101111000101000001110001110011000110111110101000001101011001000000010000010001001011010010110101011011100001100000101010001011011010011111001101101100100101110111001111000010000100110101010010110011000001000001011000000011100101000110001011010110011011010011101011101110110001000101100101110110010001111101011011101000010011010100111101011110010111100111000101010010000001000101010000100001110101000110110000011000101100111000000111100010110110101001010100000001111100111100101111000110011010100010001110010100000100010010010000011001001010011010111000011000101110011100001000001010111010010101000011110100011100101111100000110100110111111011000101110101000111111111010110001100110010101111110101100111010111010000100000011001101001011010110111010011111110110110000101001001000000000010001110010001111011111011000001110110110111110100110000111000001000110001001111100100010000010001111011110110111001000010010000010000000000101000101010001110011100100100111010111110010011000011101010110100100111000011110100110001111010000111110010100010001101000110010111000011110111101110111101001100101001000110010100000111101111001111100110101011000000110010100001010100100011101111000000111010100110011100100100111110110111100111011100111111001111111100000111000000010100111111000100100100010101011011111100100111111111001000101100110111100000111100110001100010010101101010000100001010000100001010100010101011111110110010011010100001010110010100110101110010000000001110101100000010111000100001110100000010011010010000011001001011110000010111101001100100100001110000011110011010011000011011101110011111100110101111100010101100100010010101110101000010101101101011000110111000110000011001000100110001000001000000101111000010111010100010101111000111000110000001000101010000011011111101011110000110101110011011111011101010111110101010101111001100011010111011100111011101110100001111010110111100100000011111011000011001110100000010101101101010011001111011000000010111100100110011100011010011111101100100111010100001000101000001101010011111100111110100010011101001110110001010110001110101000000100110011010010101011101110010101101001110010111010000010101001100101111101100111110111010010100011010011001101100111101100111111101100000111011010100101011101000001110011000000111000011111110000011011011101111010001101000100011010001011011111011101001011110101000010100000000001100000001000101000010110011011001101110010001011100011011101100110010100111100100110100000010001100101000100110100101011000100101001000111101100000100111010100011000110000001100110100111100111001110010110011011010100110110101111100100111011011000001001111000001101000001110110010010100001111011011001101101100001111110110111010110000101010010110010000001110111000010111010111000111111101011000110100000000111101111011100000100111111110011110100111101000010001000101001011000001011110011111110100110010001101110110110011100010000100111101011100111010001110110111000100000000111011001011101001110011010100011010100100001100101111100010111100000011001000011010101110111111000010100100101110000010111110000110110101000111111001010111100110011111011000011100111000011001100001010100111010000111101011100110000001100010110001110110110001100100101000011100111110100010010001001101111101010111110011101010001101011100011010100011100010110110111001001100111101010000100010110001100110010010101011100010001111001000010110100100111101011011010111011011100000111100011000101010010000111101100001010110100011010001000010011101111001101110001010010001110000100100001111101111011011100100111101110110100001011101110101111101011010100010010000001001011010000010101000110010011111000001110110001111100100010011000101011110110001100001000110100000101000000000001101001001110101010110111001101100011001111000100100001101001111011011010111000010011101011110011110010101010100000110010100000110100000010100100000110110100101010000001100011101010001000100011001011110010011011001100000110110000001001110101111111111011101001011110111100111110010111100001000010010001101100001110110111010100010001110100110100110100101101000101111100101101101111010000100100110010101001100110001101110000001100011111100010011110010101100100001110111111011100100110010100011011000101110011010000011001110000010101001011100000011111011010000101001001010111111011010101010000011010000101100010110111010110101100000011111000111101000010011100110101101101111110000000101101001100111000111101011001011101011000111100100011111011110010101001001100001111011001111100100001001110001000010110010000110010010101110110101110001001001010011001010111010000111110111111111010111101110100000110110000011101110100100010110000010111100111100000001101001111111111011010000111101000011110110001000100011100011100100011010110000001011110000110001001000100000101101000011100011000001101110001100100100110011000001000100011010100000001100111100111111011001000010111010001011000111100011011110011001000101000110100101011100100010010110100111101010000110110100101110111111001011011101010000010101101011000001100001011110111001000011101001011011100111100110001010111011110101011011110000110010011101111011000111000011110001011011010000000111101011000010101101100010010101010101100000010011110111110000000011100101001011000010000011010101010100000100111010011010011111001111011001110000010010110011100011100111011011111001000111000100110101001101011000110100110101011000001111110001111100001100110000100111111001110010101110110000100000011001000010100001111011010011101001010011101001010000011001001111110011011100110010010101100111000100111011111101011110010110011110101001110101100011100111010111001101010011000000111100011011100110110110011000110000000001111010111111001001010111111100000100110000110010111110101000110110011101101011101111000100011111110011111110100101001111010111110100110011011000000111000001111100011100100100110000011101100110110010000101110100011011000000011010010010100001100110110111001111110001001101011011101100011010100010101010110000001000100111101010111101100110101100101101001101110011101010101000100001001100000011000110011110010100000011001110110100001011110100101111111001111100011011100011000111101101100110101101100010101100011110000001010000110001000100101110010000100110111111010101010010101110001000001101001001001111011001010100101011010010000010000001110100110110110001100010110001100000111000001101110001010000111101101101000001010110001011010101111010101110110010110110001100000011100000101001001010001111000100101111000011100011010010110011001101001110001000101010011001011110101101001001011100100001011100011011110001101100100011100000010101000110000101001110100000110110010111001110010011001010000110000001101001011100100101101101011000010101100001010000101101101101101010111011110011101110011000001001010011110010100000111000110010111000011101100010010001111001111001010110001110000101000100111110101001110110001010100001101001100101000001100001111100110011110000111010000101011100000110001110100110111000111110010110111111001111101111111000110100000110001011100110110001010001011000111011010100101001110001111001111001010100110001110100000100010011100100110111101001101110010100000101010100111111111110101010100101100000001111001101101100111110011011010100100100101111010101001000010010010001000110111000011100110000101101110101111101101001100100000001100100011000111111100110110011001111000000011100010100011001100100100000111010110001010100110011100000110111111101101010110111010111011111110010111010110010111011101001010110010000111111001011001001101110000100010100111101110111100111011011010111111001011001110011010111000010010000001101100010100101000100110011010000001101101010011011000111000000100101001000011011001010001111001010110001010100100000101000110000000110000010110101000110011100110100110100111110110001000101000101010101100101110110010000011101001100010010110000100101100000110100111101010010110110100110100001101100010000000101011011001011110010100110001100010101111111110000111101001100000100100011111111011100101011101001010010101100111110101000011001001111110000000010011011001000011010100100111011010100110000110010001110110011000101100010000000100001101111100100101100110111011101100101010011110011010001111101110111101011111101100010011000110100101100010100010001001010001101100010101101100010001101010000011110110111100000010110100000101000100111110100000111011110101000000001000100000100111100011101010100011101010111110100001111000001100100110100011011011100000100100001100001011100001000011001010100000000000110110010011110000011011011010001110011100001110110100111100010010111100101000101111101001001010000101010000011111001000001111001010001101010110101111010101100011010111100010111000000101110111010000100110010111100011010011101000010010110101010110000011001001000010000111100100111100000110101100001000111011010010010000001110111100100101101010110000110011000111100001011010011110111101001011000100110101100001100000110011101011100111000100001000001000010011010011001011101011101101110111101111000100101010101011111101001001010111111101101100100000110001100001101111111111100010111100011011101100001011001001100100100010011011001101111111010110111001011000111000);
+#endif
+
+#undef TEST_WB_UWB
+}
+
+// Using other bases
+void
+test05()
+{
+#if __BITINT_MAXWIDTH__ >= 130
+ VERIFY( check_to_chars(-0x0000000000000000000000000000d2dewb, "-10edc", 15) );
+ VERIFY( check_to_chars(0x0000000000000000000000000000b131uwb, "z01", 36) );
+#endif
+#if __BITINT_MAXWIDTH__ >= 818
+ VERIFY( check_to_chars(0x107e57a7f73ff64fda25c25dcec8ab8f602410e8efc0108825e71dd2f76a1f17e866bfdf96b61f60dbd1be9aaa6a1a0a8e3ae37dfaf3f610eb13e3d27df2ea5659aa25e05035512c170fb6b169d0bbf80b9f65f6835c076e6feb40edde2b3427c56a08159f593uwb,
+ "21v5f9vn7vr4vmh5o9esti5bhtg28478tv011215sset5tra3sbugplvrubbc7r0rf8rt6lad8d0l3hqsduvlsvm23lh7ouifnpeklipl8iu0k1la4m1e3tmm5kt1evo1efmbtk3bg3msrvb83mtsapk4v2mk20ljtcj", 32) );
+ VERIFY( check_to_chars(-0x107e57a7f73ff64fda25c25dcec8ab8f602410e8efc0108825e71dd2f76a1f17e866bfdf96b61f60dbd1be9aaa6a1a0a8e3ae37dfaf3f610eb13e3d27df2ea5659aa25e05035512c170fb6b169d0bbf80b9f65f6835c076e6feb40edde2b3427c56a08159f593wb,
+ "-21v5f9vn7vr4vmh5o9esti5bhtg28478tv011215sset5tra3sbugplvrubbc7r0rf8rt6lad8d0l3hqsduvlsvm23lh7ouifnpeklipl8iu0k1la4m1e3tmm5kt1evo1efmbtk3bg3msrvb83mtsapk4v2mk20ljtcj", 32) );
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 235
+ // 30664178903177895962182284621809541028218926436213591560715855479110857uwb in all bases.
+ const char* str235[37] = { nullptr, nullptr,
+ "1000111000101100101110010011100001111000001000111000001111110010111000111101010101100010010101011110110101100010101101000111000000010000011111001111011011101111111010000110101100101000011111100010110001100011000101111101111110011001001",
+ "2020102022011022101211200201011000222122101212120100100211000101102202112102120200011102000221001002210021020011110121012022010022020210121120122010",
+ "1013011211302130033001013001332113013222230102223312230111220320002003321323131333100311211003330112030120233233303021",
+ "34204213124404223132424304330034423322123003100421142320322344114333231400042333332122034010123021412",
+ "2501003403401034230245013434142331320055523514134311321240520253214001354425512242543450133",
+ "213031503522025614316130460336111535140326111511162563001556005251454361610146451163",
+ "1070545623417010701762707525422536654255070020371733577206545037426143057576311",
+ "66368138354621130878355510324011382472520142027032707204417168108223546563",
+ "30664178903177895962182284621809541028218926436213591560715855479110857",
+ "5193655752857576a5100425338144a54a328151396a284348648a29808891264901",
+ "222b1966357857082b809b76025482822698aa4a14b43a17194400468769bb6949",
+ "20581ba003a63a164a86ca616b24760004856134a77a397ca22382cb26774ba7",
+ "3a4d522431c24d9b10121467cc9210cc70a0c2447433254c46758d7d7b3933",
+ "c79a3be56bc1ea19794e59d3a9e430c8a4de937844beb310bb815801d33c",
+ "47165c9c3c11c1f971eab12af6b15a38083e7b77f435943f16318befcc9",
+ "24294ca6b1e9ded52fa60e8f4a0e4f6a8e27969d874fd336409g05fec9",
+ "19h74c1a99dfcd686bc84h4eg8bc6bb6h27050hh788d58g7ca15e6833",
+ "1830h97g2908e7i82ef9a1hh46id64b15e22c4df90c1699bfdc88394",
+ "1e0hcc7gf80ieb097324jgd4ii4fe1338de201ig23h2b3321h48h2h",
+ "2bhk391kdf6e6a3eh2197726jgd7j4795f3d24a319dji89d65e693",
+ "4ha121hei11gg22ged57680fkf0k0g63d27kdb3c9ha55532afg01",
+ "al7c28alb48j05a79bimb3aamj389c8cm4j1c35dhj1gm73f4h63",
+ "15m64f3ckah00h9481lfhfl8ag1aj43dencj27hf3916ih0hn889",
+ "3m4bgekmd8eefnf3odhbd0g0m6mh3cjl9ihgk0miih7aj11d297",
+ "e5jeaj1efo1e9hl159l8815e4hcnjj9l4ambkmi3373pclf657",
+ "26b848amij40qhanf99m0abkebfi4b0p12l764cg58386lgfh3",
+ "af77c9m759pjorcffchbkmilircbf242hp46q2n9h688fg5mh",
+ "1rlh8qh26haksomka7dd2j5pkb9rm119o970dn04ps206qcm0",
+ "bftdqg62hkd5c9fdfd1fsfptmeoprijbsmsmtbs1hij6kc1r",
+ "2eh9m9nk082ei7f72h3io2incbtjshqdut05lk416nl0iueg",
+ "hombie3o4e1v5oulc9auqolke087ptnft1ligvhcccbtv69",
+ "4ad4fp675fchmdejb9taq8e6d4jcqkbpminivtwrf202kic",
+ "135fdb6f5v0psedxdv36juct3e8511q320qtfdfg512gt69",
+ "a2v3acj7jnhp30adof8uyje34b1fm29tbdq6oi5i33uijh",
+ "2u63om13qigu9rpql9c5zfvpmj9dg5chka09yqz8ghrt1l"
+ };
+
+ for (int base = 2; base <= 36; ++base)
+ VERIFY( check_to_chars(30664178903177895962182284621809541028218926436213591560715855479110857uwb,
+ str235[base], base) );
+#endif
+
+#if __BITINT_MAXWIDTH__ >= 512
+ // -5703471763188962899063433308439520731869372953450868147003925262718888041530885199598754693236806775695258577874348055646642615291464458106275713090215609wb
+ // in all bases.
+ const char* str512[37] = { nullptr, nullptr,
+ "-1101100111001011111110101000000001001100100100111011000100010001111011111010101001110101011100010011000011100110111011010101110111101011111100010011111110001100001001111000000100111000010100110011011010000110100000011010101101000110100111101010010100011110011010101010000110100000101101110011001101010001110001110010000011111010001110101001001000101011001000110111111110001001000011010110111011000110100110011001011001000111110100011110100101111100010110000110100100101001100111110000100111001100101111010111001",
+ "-10222112122111211200200002000011022222200112210222200022210120121121200222221221012201122221212202101101202101001122210100112102000200022002020112012202122000210100021221001000002222020210211122022011011102110001202211201012200121211010011012220200121121011111020120000002221021020120212000100012001121102212022202101000100",
+ "-1230321133311000021210213120202033133111032223202120130313122232331133202133301201033000213002212123100310003111220310331102203303111100310011232121222032032100133101311021011121012333301020122313120310303023020332203310233202300310211030332010321211322321",
+ "-4400310323342140000221332324213204111040424443304021433241211122212140034414412203423010222342133421003204302241243314001342011112223041240001414114043143241443341234224041312112300023003222132134441221232240402043344414",
+ "-251523540225240055320333145531101400112135020155413444552422332412215253145451040340331205223553544141023202223215213055104140012102055415342431231520423353004113201502503433543443304052344224430013",
+ "-61333411631311452305536113550122113015636165012105631355326210360143314560444514332551160343461403133200635333303566246011142303612224441431266322412406402364453064425603560411463660",
+ "-154713765001144473042173725165342303467325675374237614117004702463320640325506475224363252064055631521616203721651105310677611032673064631310764364574260644514760471457271",
+ "-128478454620060138880483880283517550887835648855671352331583315360608066465678023307831002866724568134373052751180554104186617534436500087236525010161542768671010",
+ "-5703471763188962899063433308439520731869372953450868147003925262718888041530885199598754693236806775695258577874348055646642615291464458106275713090215609",
+ "-476895809768537439070aa41595269450693325386691a8a049578a1590a40a03a7460522a5a3541396698083844a9303a9127a79844436122551a9322021084703586a89a63367a416",
+ "-33068700915a621442702a66bb1a7036a407775578786273660a762602442a7047a4156036441734553676a6958b9a0aa940a1457169b4a2567016a29532b483b80404924478309",
+ "-10cb9b1909976121176bbb6b4c20c5b25c10563ba26c63492995a9598992c74ca146b0386cc68c609911028975663c05175b787bb7238c64b7876a9223658506019280302c2",
+ "-16d371094cdbb0159bb8c9cc0ba726c7d28dd0464c57d84b140cc323cca030c7848902004ac2c23ca4d23751819c368a19727cacb25d1b116a622dcb659258269783dd7",
+ "-74b19213b2673e37a6b1c1e1badbe2d2d4baa114c3d45d93dd213a1ec0aa08469b55a349331a4ada944656c540d1d383331757647792bbce8bab70648bc4e322609",
+ "-6ce5fd402649d888f7d53ab8987376aef5f89fc613c09c299b4340d5a34f528f3550d05b99a8e3907d1d491591bfc486b7634ccb23e8f4be2c3494cf84e65eb9",
+ "-f29g52gg6a6gb6291fgf23894e30g722622a04c9c7079a76d8d8286c155gef6cb9ae19080cb83c25g4c5d3492f127egc98f7b3da251f685d8004cd855c901",
+ "-41ed4808429fg0fbh482071c54485cha87gb44d6a1b159b528c11chg2839ac1fbh0dag305dd13073ec59aeb34145e12e612fb843061c61a70df20798009",
+ "-207fa39b7646a1c7d90fd2ba4h3a73fg7336c9ffea501h9bbc7hf8ab59140g4ahdg3787be7fach120h0634dai33f2fi9690a5i068f53613658e550f5a",
+ "-1e6ac3ab2f86138ffj125ff15716gc42998095iga7eie1gafd58h1c25eh6d1c1466c5cc9ge5e2ed1834757d8h72cifc4d5e83ij64i770jf0h0dgj09",
+ "-284f54a1eee40hbdc5173bbe5fkj73003g33e72eag0872bch485jdc12dj2h19j655hbdhjkib66j5ak017jh46eg7ddg0k9hfd9e70i13f0g3kf7j90",
+ "-559hbihicj5i69jl7bid22jf9ib10ealk3di2a2laj9jdfk0a5j9di128182f34d3g7hk2el92deedbkf1ka18hk0e51he1lg5171f52jjjec1k9c0h",
+ "-hb2eaaf39il8ab53ehdh49eb3ea73ij0j2l69jdf38a93m1ca5jg1254i27mc2g2679fh8fkl2am1g39cdg2ja20846efci7fh58m638h66hjgcgi",
+ "-3dga7hcalb2iih7ddi8h72ka6l472bgfcl5dhea76b3fdck2339m61gdb879513ne3igdbi2hme66m328n47997mg3gk9km5did0457358gfbci9",
+ "-o0g3djbk02bidebh465kmonfkbnhlb6cbbk3o9lc3mf5cdm8jb0h4fclei908m167cfle01ll94gne9nj7jcklgb7f0d0hc8bjo7bdckkanjo9",
+ "-8hoaif8j111fm2d5poa50187doho6n79gk8ifidgn1a2085aici442ocmhgbn6d5occgl47pnh9dl61kd7mod8ecb14c854pgac1f0b2begpf",
+ "-3qehdmii2048qielqi8lfggiqpp5jhpnkaaka1hl9eb0i826e5kh0l97p102q6lmh844bc1kmj5igm345oigg4d6f02p76fn0951gbn8ka09",
+ "-27l7g2j95g34e1bc3erli3abierkdigirinn8j7bigkg4iakg44cmli1hg1koda20qi7o042ccmp67l7r99idjh388q7r387l7mi5nborrl",
+ "-1hc90oq2ego297enoa8q4ib2gccgo9aa24nbh3mo066mlfb94cq9pm2hgkaem59c1sb1cehm94kfs1ne8861cobhhm0b2cne5j41disshj",
+ "-1atij0814h31maij7gnt709bt8htln6a7t350ggrrge89l39e8o9ott75fk8rb9961ohrpbbi5bt9oa1oc89k1r9m3gsq4r8fh7skmo09",
+ "-1cbk1hdgf6501mk6d5eb7mqemgqs9k63bhg9n2baqbncgcst4amgq7r5938i31a3gh3kk95mtmbk0ea76u4og4af5rm8j59nau66rsg8",
+ "-1mebva04p4th27nqktbh63jeqnfbu4voo9s1719jd1k1ld39t98udagq1dpja73i1uhqi8li6vs91lncd6cm8v8uiv2od4kpu2ecnlp",
+ "-2ea2msned2agjmuijl29etbfapve8d5egn7jmjuibnaof703fu26ddesvcdt5gfcgdqv5boqgaws919k40ov35megvjhuf8vate7q6",
+ "-41wbwqa75vhk119i0jr56mbrtr2i2lkahih6si2rrsuiba1mcla8ntkbb30doo834p8e4qsi8e6oh4pn9edv7ab4ilw71lu4w7w01",
+ "-7sssxtc3j0pu7xh3q1u2vt7a8ct4ev59i7qshbpubucvswxt5icyaw5536evu0l42w3ou9griu00r56hmln1dfo25o9fa2tyt3ce",
+ "-hbfy2hg0zk3lazj6a07dn21zpmszgelg8dwxayv43ol85enxypp2k2ekbdiz6po1d25ybmgjfbcqlx0p9cb2umlymriowmqgr09"
+ };
+
+ for (int base = 2; base <= 36; ++base)
+ VERIFY( check_to_chars(-5703471763188962899063433308439520731869372953450868147003925262718888041530885199598754693236806775695258577874348055646642615291464458106275713090215609wb,
+ str512[base], base) );
+#endif
+}
+
+#if __cpp_lib_constexpr_charconv >= 202207L
+constexpr bool
+test06 ()
+{
+ std::to_chars_result res;
+ char buf[700];
+
+ res = std::to_chars(buf, buf+sizeof(buf), 34359738367wb, 10);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "34359738367" );
+#if __BITINT_MAXWIDTH__ >= 176
+ res = std::to_chars(buf, buf+sizeof(buf), 37985637301123963008723772120681536236860287245700899uwb, 10);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "37985637301123963008723772120681536236860287245700899" );
+#endif
+#if __BITINT_MAXWIDTH__ >= 2049
+ res = std::to_chars(buf, buf+sizeof(buf), -10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430wb);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "-10400417464661000293456981837800634962727410669733243431402542308501845987415822304480512712471524198929651559891932026952194821072693463751410864529255368010343062853183410059100446583707322720879846509545482750073940634246143008554873129580833221880589347026162031126717796847359892821580072122520372217168551436683905640480459944026325821223214327578470630406871948016905724692688603276682680279137750486493328675218273516447867335298817942586889759530492080936672635245735633776631200193505298670759926268952563909928720841170088423728609996058761269425601477355874040135200351557235498726991979276828531901402430" );
+#endif
+ res = std::to_chars(buf, buf+sizeof(buf), 0x23e2c3000166d905uwb, 16);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "23e2c3000166d905" );
+#if __BITINT_MAXWIDTH__ >= 575
+ res = std::to_chars(buf, buf+sizeof(buf), 0x59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3uwb, 16);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "59886e6bc1ed5ccbebd23bf95384e311f974e0532a091438a4fb854a4ecf5ea847bd04199a50d57623017f769652888fd768d2f161e72a06d2af51216eafc9b65ccdcfe71e955d3" );
+#endif
+ res = std::to_chars(buf, buf+sizeof(buf), 02157434427317757uwb, 8);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "2157434427317757" );
+#if __BITINT_MAXWIDTH__ >= 212
+ res = std::to_chars(buf, buf+sizeof(buf), -025137136463562376774153767115327363064061306122026717wb, 8);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "-25137136463562376774153767115327363064061306122026717" );
+#endif
+ res = std::to_chars(buf, buf+sizeof(buf), 0b101001101111uwb, 2);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "101001101111" );
+#if __BITINT_MAXWIDTH__ >= 205
+ res = std::to_chars(buf, buf+sizeof(buf), 0b100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100wb, 2);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "100000011111000011011010010110010000010011000100001101101001001100001001101001110111011100110010010111011110111111100010101001001101011100000001011110110011001100110010111011110011010010101001111100110100" );
+#endif
+#if __BITINT_MAXWIDTH__ >= 235
+ res = std::to_chars(buf, buf+sizeof(buf), 30664178903177895962182284621809541028218926436213591560715855479110857uwb, 5);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "34204213124404223132424304330034423322123003100421142320322344114333231400042333332122034010123021412" );
+ res = std::to_chars(buf, buf+sizeof(buf), -30664178903177895962182284621809541028218926436213591560715855479110857wb, 36);
+ VERIFY( res.ec == std::errc{} );
+ VERIFY( std::string_view(buf, res.ptr) == "-2u63om13qigu9rpql9c5zfvpmj9dg5chka09yqz8ghrt1l" );
+#endif
+
+ return true;
+}
+
+static_assert(test06 ());
+#endif
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+}
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.byteswap/bitint.cc 2026-11-11 21:39:13.024560291 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.byteswap/bitint.cc 2026-11-11 21:39:13.024560291 +0100
@@ -0,0 +1,70 @@
+// { dg-do compile { target c++23 } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <bit>
+
+void
+test01()
+{
+#if __CHAR_BIT__ == 8
+ static_assert( sizeof(_BitInt(8)) != 1
+ || std::byteswap<_BitInt(8)>(0x12wb) == 0x12wb );
+ static_assert( sizeof(_BitInt(16)) != 2
+ || std::byteswap<_BitInt(16)>(0x1234wb) == 0x3412wb );
+ static_assert( sizeof(_BitInt(32)) != 4
+ || std::byteswap<_BitInt(32)>(0x12345678wb) == 0x78563412wb );
+ static_assert( sizeof(_BitInt(64)) != 8
+ || (std::byteswap<_BitInt(64)>(0x123456789abcdef0wb)
+ == static_cast<_BitInt(64)>(0xf0debc9a78563412uwb)) );
+#if __BITINT_MAXWIDTH__ >= 128
+ constexpr unsigned _BitInt(128) c1 = 0x0102030405060708090a0b0c0d0e0f10uwb;
+ constexpr unsigned _BitInt(128) c2 = 0x100f0e0d0c0b0a090807060504030201uwb;
+ constexpr unsigned _BitInt(128) c3 = 0xf1e2d3c4b5a69788796a5b4c3d2e1f10uwb;
+ constexpr unsigned _BitInt(128) c4 = 0x101f2e3d4c5b6a798897a6b5c4d3e2f1uwb;
+ static_assert( sizeof(_BitInt(128)) != 16
+ || (std::byteswap<_BitInt(128)>(_BitInt(128)(c1))
+ == static_cast<_BitInt(128)>(_BitInt(128)(c2))) );
+ static_assert( sizeof(_BitInt(128)) != 16
+ || (std::byteswap<_BitInt(128)>(_BitInt(128)(c3))
+ == static_cast<_BitInt(128)>(_BitInt(128)(c4))) );
+#endif
+#if __BITINT_MAXWIDTH__ >= 512
+ constexpr unsigned _BitInt(512) c5 = 0x8d4dd94fbe44a90ed369f03356fa5f3233fd51e628240f88fddc4c1b7148d0fe96a94e54edf762c06053f4b64d53e880503a66785e76015b524d76c49547c22buwb;
+ constexpr unsigned _BitInt(512) c6 = 0x2bc24795c4764d525b01765e78663a5080e8534db6f45360c062f7ed544ea996fed048711b4cdcfd880f2428e651fd33325ffa5633f069d30ea944be4fd94d8duwb;
+ constexpr unsigned _BitInt(512) c7 = 0x6568c6970b6d341e941205ca4916145af60c1e502cb823b5c4ec62884485e1cfeda767f8159b17a9ad1c73f732875128946f79c0289c76ec88d874cc5d559c4buwb;
+ constexpr unsigned _BitInt(512) c8 = 0x4b9c555dcc74d888ec769c28c0796f9428518732f7731cada9179b15f867a7edcfe185448862ecc4b523b82c501e0cf65a141649ca0512941e346d0b97c66865uwb;
+ static_assert( sizeof(_BitInt(512)) != 64
+ || (std::byteswap<_BitInt(512)>(_BitInt(512)(c5))
+ == static_cast<_BitInt(512)>(_BitInt(512)(c6))) );
+ static_assert( sizeof(_BitInt(512)) != 64
+ || (std::byteswap<_BitInt(512)>(_BitInt(512)(c7))
+ == static_cast<_BitInt(512)>(_BitInt(512)(c8))) );
+#endif
+ static_assert( sizeof(unsigned _BitInt(8)) != 1
+ || std::byteswap<unsigned _BitInt(8)>(0x12uwb) == 0x12uwb );
+ static_assert( sizeof(unsigned _BitInt(16)) != 2
+ || std::byteswap<unsigned _BitInt(16)>(0x1234uwb) == 0x3412uwb );
+ static_assert( sizeof(unsigned _BitInt(32)) != 4
+ || std::byteswap<unsigned _BitInt(32)>(0x12345678uwb) == 0x78563412uwb );
+ static_assert( sizeof(unsigned _BitInt(64)) != 8
+ || (std::byteswap<unsigned _BitInt(64)>(0x123456789abcdef0uwb)
+ == 0xf0debc9a78563412uwb) );
+#if __BITINT_MAXWIDTH__ >= 128
+ static_assert( sizeof(unsigned _BitInt(128)) != 16
+ || std::byteswap<unsigned _BitInt(128)>(c1) == c2 );
+ static_assert( sizeof(unsigned _BitInt(128)) != 16
+ || std::byteswap<unsigned _BitInt(128)>(c3) == c4 );
+#endif
+#if __BITINT_MAXWIDTH__ >= 512
+ static_assert( sizeof(unsigned _BitInt(512)) != 64
+ || std::byteswap<unsigned _BitInt(512)>(c5) == c6 );
+ static_assert( sizeof(unsigned _BitInt(512)) != 64
+ || std::byteswap<unsigned _BitInt(512)>(c7) == c8 );
+#endif
+#endif
+}
+
+int main()
+{
+ test01();
+}
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countl_one.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countl_one.cc 2026-11-11 21:39:13.025319548 +0100
@@ -32,11 +32,14 @@ test(UInt x)
static_assert( std::countl_one((UInt)0) == 0 );
static_assert( std::countl_one((UInt)-1) == digits );
- static_assert( std::countl_one((UInt)3) == 0 );
- static_assert( std::countl_one((UInt)((UInt)1 << digits - 1)) == 1 );
- static_assert( std::countl_one((UInt)((UInt)3 << digits - 2)) == 2 );
- static_assert( std::countl_one((UInt)((UInt)7 << digits - 3)) == 3 );
- static_assert( std::countl_one((UInt)((UInt)255 << digits - 8)) == 8 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::countl_one((UInt)3) == 0 );
+ static_assert( std::countl_one((UInt)((UInt)1 << digits - 1)) == 1 );
+ static_assert( std::countl_one((UInt)((UInt)3 << digits - 2)) == 2 );
+ static_assert( std::countl_one((UInt)((UInt)7 << digits - 3)) == 3 );
+ static_assert( std::countl_one((UInt)((UInt)255 << digits - 8)) == 8 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -93,6 +96,16 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countl_zero.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countl_zero.cc 2026-11-11 21:39:13.025429781 +0100
@@ -32,9 +32,12 @@ test(UInt x)
static_assert( std::countl_zero((UInt)0) == digits );
static_assert( std::countl_zero((UInt)-1) == 0 );
- static_assert( std::countl_zero((UInt)1) == digits - 1 );
- static_assert( std::countl_zero((UInt)3) == digits - 2 );
- static_assert( std::countl_zero((UInt)0b0101'1010) == digits - 7 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::countl_zero((UInt)1) == digits - 1 );
+ static_assert( std::countl_zero((UInt)3) == digits - 2 );
+ static_assert( std::countl_zero((UInt)0b0101'1010) == digits - 7 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -90,6 +93,16 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countr_one.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countr_one.cc 2026-11-11 21:39:13.025522009 +0100
@@ -31,12 +31,16 @@ test(UInt x)
static_assert( std::countr_one((UInt)0) == 0 );
static_assert( std::countr_one((UInt)-1) == digits );
- static_assert( std::countr_one((UInt)127) == 7 );
- static_assert( std::countr_one((UInt)1) == 1 );
- static_assert( std::countr_one((UInt)3) == 2 );
- static_assert( std::countr_one((UInt)0x1f) == 5 );
- static_assert( std::countr_one((UInt)((UInt)-1 ^ 0x10)) == 4 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::countr_one((UInt)127) == 7 );
+
+ static_assert( std::countr_one((UInt)1) == 1 );
+ static_assert( std::countr_one((UInt)3) == 2 );
+ static_assert( std::countr_one((UInt)0x1f) == 5 );
+ static_assert( std::countr_one((UInt)((UInt)-1 ^ 0x10)) == 4 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -92,6 +96,16 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countr_zero.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.count/countr_zero.cc 2026-11-11 21:39:13.025605928 +0100
@@ -33,9 +33,12 @@ test(UInt x)
static_assert( std::countr_zero((UInt)-1) == 0 );
static_assert( std::countr_zero((UInt)127) == 0 );
- static_assert( std::countr_zero((UInt)1) == 0 );
- static_assert( std::countr_zero((UInt)2) == 1 );
- static_assert( std::countr_zero((UInt)0x70) == 4 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::countr_zero((UInt)1) == 0 );
+ static_assert( std::countr_zero((UInt)2) == 1 );
+ static_assert( std::countr_zero((UInt)0x70) == 4 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -91,6 +94,16 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.count/popcount.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.count/popcount.cc 2026-11-11 21:39:13.025689664 +0100
@@ -32,11 +32,14 @@ test(UInt x)
static_assert( std::popcount((UInt)0) == 0 );
static_assert( std::popcount((UInt)-1) == digits );
static_assert( std::popcount((UInt)-2) == digits - 1 );
- static_assert( std::popcount((UInt)127) == 7 );
-
static_assert( std::popcount((UInt)1) == 1 );
- static_assert( std::popcount((UInt)2) == 1 );
- static_assert( std::popcount((UInt)0x70) == 3 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::popcount((UInt)127) == 7 );
+
+ static_assert( std::popcount((UInt)2) == 1 );
+ static_assert( std::popcount((UInt)0x70) == 3 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -94,6 +97,16 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc 2026-11-11 21:39:13.025788059 +0100
@@ -44,11 +44,14 @@ test(UInt x)
static_assert( std::bit_ceil(UInt(0)) == 1 );
static_assert( std::bit_ceil(UInt(1)) == 1 );
- static_assert( std::bit_ceil(UInt(2)) == 2 );
- static_assert( std::bit_ceil(UInt(3)) == 4 );
- static_assert( std::bit_ceil(UInt(4)) == 4 );
- static_assert( std::bit_ceil(UInt(0x11)) == 0x20 );
- static_assert( std::bit_ceil(UInt(0x20)) == 0x20 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::bit_ceil(UInt(2)) == 2 );
+ static_assert( std::bit_ceil(UInt(3)) == 4 );
+ static_assert( std::bit_ceil(UInt(4)) == 4 );
+ static_assert( std::bit_ceil(UInt(0x11)) == 0x20 );
+ static_assert( std::bit_ceil(UInt(0x20)) == 0x20 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -78,10 +81,13 @@ test(UInt x)
static_assert( std::bit_ceil( UInt(msb - 3) ) == msb );
// P1355R2: not a constant expression if the result is not representable
- static_assert( !bit_ceil_valid<UInt(msb + 1)>() );
- static_assert( !bit_ceil_valid<max<UInt>>() );
- static_assert( !bit_ceil_valid<UInt(max<UInt> - 1)>() );
- static_assert( !bit_ceil_valid<UInt(max<UInt> - 2)>() );
+ if constexpr (std::numeric_limits<UInt>::digits > 1)
+ {
+ static_assert( !bit_ceil_valid<UInt(msb + 1)>() );
+ static_assert( !bit_ceil_valid<max<UInt>>() );
+ static_assert( !bit_ceil_valid<UInt(max<UInt> - 1)>() );
+ static_assert( !bit_ceil_valid<UInt(max<UInt> - 2)>() );
+ }
return true;
}
@@ -126,6 +132,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))0 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc 2026-11-11 21:39:13.025879357 +0100
@@ -29,11 +29,14 @@ test(UInt x)
static_assert( std::bit_floor(UInt(0)) == 0 );
static_assert( std::bit_floor(UInt(1)) == 1 );
- static_assert( std::bit_floor(UInt(2)) == 2 );
- static_assert( std::bit_floor(UInt(3)) == 2 );
- static_assert( std::bit_floor(UInt(4)) == 4 );
- static_assert( std::bit_floor(UInt(0x11)) == 0x10 );
- static_assert( std::bit_floor(UInt(0x20)) == 0x20 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::bit_floor(UInt(2)) == 2 );
+ static_assert( std::bit_floor(UInt(3)) == 2 );
+ static_assert( std::bit_floor(UInt(4)) == 4 );
+ static_assert( std::bit_floor(UInt(0x11)) == 0x10 );
+ static_assert( std::bit_floor(UInt(0x20)) == 0x20 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -98,6 +101,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))0 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_width.cc 2026-01-02 22:41:17.876543658 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_width.cc 2026-11-11 21:39:13.025966950 +0100
@@ -29,11 +29,14 @@ test(UInt x)
static_assert( std::bit_width(UInt(0)) == 0 );
static_assert( std::bit_width(UInt(1)) == 1 );
- static_assert( std::bit_width(UInt(2)) == 2 );
- static_assert( std::bit_width(UInt(3)) == 2 );
- static_assert( std::bit_width(UInt(4)) == 3 );
- static_assert( std::bit_width(UInt(0x11)) == 5 );
- static_assert( std::bit_width(UInt(0x20)) == 6 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::bit_width(UInt(2)) == 2 );
+ static_assert( std::bit_width(UInt(3)) == 2 );
+ static_assert( std::bit_width(UInt(4)) == 3 );
+ static_assert( std::bit_width(UInt(0x11)) == 5 );
+ static_assert( std::bit_width(UInt(0x20)) == 6 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -98,6 +101,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))0 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc 2026-01-02 22:41:17.877543642 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc 2026-11-11 21:39:13.026067282 +0100
@@ -28,23 +28,30 @@ test(UInt x)
static_assert( noexcept(std::has_single_bit(x)) );
static_assert( ! std::has_single_bit( (UInt)0 ) );
- static_assert( ! std::has_single_bit( (UInt)-1 ) );
- static_assert( ! std::has_single_bit( (UInt)3 ) );
- static_assert( ! std::has_single_bit( (UInt)0x0f ) );
- static_assert( ! std::has_single_bit( (UInt)0xff ) );
- static_assert( ! std::has_single_bit( (UInt)0x0a ) );
- static_assert( ! std::has_single_bit( (UInt)0xa0 ) );
+ if constexpr (std::numeric_limits<UInt>::digits > 1)
+ static_assert( ! std::has_single_bit( (UInt)-1 ) );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( ! std::has_single_bit( (UInt)3 ) );
+ static_assert( ! std::has_single_bit( (UInt)0x0f ) );
+ static_assert( ! std::has_single_bit( (UInt)0xff ) );
+ static_assert( ! std::has_single_bit( (UInt)0x0a ) );
+ static_assert( ! std::has_single_bit( (UInt)0xa0 ) );
+ }
constexpr UInt one = 1;
static_assert( std::has_single_bit( (UInt)(one << 0) ) );
- static_assert( std::has_single_bit( (UInt)(one << 1) ) );
- static_assert( std::has_single_bit( (UInt)(one << 2) ) );
- static_assert( std::has_single_bit( (UInt)(one << 3) ) );
- static_assert( std::has_single_bit( (UInt)(one << 4) ) );
- static_assert( std::has_single_bit( (UInt)(one << 5) ) );
- static_assert( std::has_single_bit( (UInt)(one << 6) ) );
- static_assert( std::has_single_bit( (UInt)(one << 7) ) );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::has_single_bit( (UInt)(one << 1) ) );
+ static_assert( std::has_single_bit( (UInt)(one << 2) ) );
+ static_assert( std::has_single_bit( (UInt)(one << 3) ) );
+ static_assert( std::has_single_bit( (UInt)(one << 4) ) );
+ static_assert( std::has_single_bit( (UInt)(one << 5) ) );
+ static_assert( std::has_single_bit( (UInt)(one << 6) ) );
+ static_assert( std::has_single_bit( (UInt)(one << 7) ) );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -87,7 +94,8 @@ test(UInt x)
{
static_assert( std::has_single_bit( (UInt)(one << 32) ) );
static_assert( std::has_single_bit( (UInt)(one << 33) ) );
- static_assert( std::has_single_bit( (UInt)(one << 41) ) );
+ if constexpr (std::numeric_limits<UInt>::digits > 41)
+ static_assert( std::has_single_bit( (UInt)(one << 41) ) );
static_assert( ! std::has_single_bit( (UInt)((one << 32) + 1) ) );
static_assert( ! std::has_single_bit( (UInt)((one << 32) + (one << 31)) ) );
@@ -146,6 +154,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))0 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.rotate/rotl.cc 2026-01-02 22:41:17.877543642 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.rotate/rotl.cc 2026-11-11 21:39:13.026173365 +0100
@@ -53,24 +53,27 @@ test(UInt x)
static_assert( std::rotl((UInt)-1, 4) == (UInt)-1 );
static_assert( std::rotl((UInt)-1, 8) == (UInt)-1 );
- static_assert( std::rotl((UInt)1, 0) == (UInt)1 << 0 );
- static_assert( std::rotl((UInt)1, 1) == (UInt)1 << 1 );
- static_assert( std::rotl((UInt)1, 4) == (UInt)1 << 4 );
- static_assert( std::rotl((UInt)1, digits) == (UInt)1 );
- static_assert( std::rotl((UInt)7, digits) == (UInt)7 );
- static_assert( std::rotl((UInt)6, digits - 1) == (UInt)3 );
- static_assert( std::rotl((UInt)3, 6) == (UInt)3 << 6 );
-
- static_assert( std::rotl((UInt)0b0110'1100, 1) == 0b1101'1000 );
- static_assert( std::rotl((UInt)0b0110'1100, digits - 1) == 0b0011'0110 );
-
- static_assert( std::rotl((UInt)0x01, 0 ) == 0x01 );
- static_assert( std::rotl((UInt)0x10, 0 ) == 0x10 );
- static_assert( std::rotl((UInt)0x10, 1 ) == 0x20 );
- static_assert( std::rotl((UInt)0x10, 2 ) == 0x40 );
- static_assert( std::rotl((UInt)0x10, 3 ) == 0x80 );
- static_assert( std::rotl((UInt)0x11, 1 ) == 0x22 );
- static_assert( std::rotl((UInt)0x11, 2 ) == 0x44 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::rotl((UInt)1, 0) == (UInt)1 << 0 );
+ static_assert( std::rotl((UInt)1, 1) == (UInt)1 << 1 );
+ static_assert( std::rotl((UInt)1, 4) == (UInt)1 << 4 );
+ static_assert( std::rotl((UInt)1, digits) == (UInt)1 );
+ static_assert( std::rotl((UInt)7, digits) == (UInt)7 );
+ static_assert( std::rotl((UInt)6, digits - 1) == (UInt)3 );
+ static_assert( std::rotl((UInt)3, 6) == (UInt)3 << 6 );
+
+ static_assert( std::rotl((UInt)0b0110'1100, 1) == 0b1101'1000 );
+ static_assert( std::rotl((UInt)0b0110'1100, digits - 1) == 0b0011'0110 );
+
+ static_assert( std::rotl((UInt)0x01, 0 ) == 0x01 );
+ static_assert( std::rotl((UInt)0x10, 0 ) == 0x10 );
+ static_assert( std::rotl((UInt)0x10, 1 ) == 0x20 );
+ static_assert( std::rotl((UInt)0x10, 2 ) == 0x40 );
+ static_assert( std::rotl((UInt)0x10, 3 ) == 0x80 );
+ static_assert( std::rotl((UInt)0x11, 1 ) == 0x22 );
+ static_assert( std::rotl((UInt)0x11, 2 ) == 0x44 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -78,7 +81,8 @@ test(UInt x)
static_assert( std::rotl((UInt)0b1010'0101, 4) == 0b1010'0101'0000 );
}
- static_assert( test_negative_shifts<UInt>() );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ static_assert( test_negative_shifts<UInt>() );
return true;
}
@@ -123,6 +127,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))0 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.rotate/rotr.cc 2026-01-02 22:41:17.877543642 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.rotate/rotr.cc 2026-11-11 21:39:13.026271168 +0100
@@ -53,24 +53,27 @@ test(UInt x)
static_assert( std::rotr((UInt)-1, 4) == (UInt)-1 );
static_assert( std::rotr((UInt)-1, 8) == (UInt)-1 );
- static_assert( std::rotr((UInt)128, 0) == (UInt)128 >> 0 );
- static_assert( std::rotr((UInt)128, 1) == (UInt)128 >> 1 );
- static_assert( std::rotr((UInt)128, 4) == (UInt)128 >> 4 );
- static_assert( std::rotr((UInt)1, digits) == (UInt)1 );
- static_assert( std::rotr((UInt)7, digits) == (UInt)7 );
- static_assert( std::rotr((UInt)6, digits - 1) == (UInt)12 );
- static_assert( std::rotr((UInt)36, digits - 2) == (UInt)144 );
-
- static_assert( std::rotr((UInt)0b0110'1100, 1) == 0b0011'0110 );
- static_assert( std::rotr((UInt)0b0110'1100, digits - 1) == 0b1101'1000 );
-
- static_assert( std::rotr((UInt)0x01, 0 ) == 0x01 );
- static_assert( std::rotr((UInt)0x10, 0 ) == 0x10 );
- static_assert( std::rotr((UInt)0x10, 1 ) == 0x08 );
- static_assert( std::rotr((UInt)0x10, 2 ) == 0x04 );
- static_assert( std::rotr((UInt)0x10, 3 ) == 0x02 );
- static_assert( std::rotr((UInt)0x11, digits - 1 ) == 0x22 );
- static_assert( std::rotr((UInt)0x11, digits - 2 ) == 0x44 );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ {
+ static_assert( std::rotr((UInt)128, 0) == (UInt)128 >> 0 );
+ static_assert( std::rotr((UInt)128, 1) == (UInt)128 >> 1 );
+ static_assert( std::rotr((UInt)128, 4) == (UInt)128 >> 4 );
+ static_assert( std::rotr((UInt)1, digits) == (UInt)1 );
+ static_assert( std::rotr((UInt)7, digits) == (UInt)7 );
+ static_assert( std::rotr((UInt)6, digits - 1) == (UInt)12 );
+ static_assert( std::rotr((UInt)36, digits - 2) == (UInt)144 );
+
+ static_assert( std::rotr((UInt)0b0110'1100, 1) == 0b0011'0110 );
+ static_assert( std::rotr((UInt)0b0110'1100, digits - 1) == 0b1101'1000 );
+
+ static_assert( std::rotr((UInt)0x01, 0 ) == 0x01 );
+ static_assert( std::rotr((UInt)0x10, 0 ) == 0x10 );
+ static_assert( std::rotr((UInt)0x10, 1 ) == 0x08 );
+ static_assert( std::rotr((UInt)0x10, 2 ) == 0x04 );
+ static_assert( std::rotr((UInt)0x10, 3 ) == 0x02 );
+ static_assert( std::rotr((UInt)0x11, digits - 1 ) == 0x22 );
+ static_assert( std::rotr((UInt)0x11, digits - 2 ) == 0x44 );
+ }
if constexpr (std::numeric_limits<UInt>::digits > 8)
{
@@ -80,7 +83,8 @@ test(UInt x)
== (0b1010 | ((UInt)0b0101 << digits - 4)) );
}
- static_assert( test_negative_shifts<UInt>() );
+ if constexpr (std::numeric_limits<UInt>::digits >= 8)
+ static_assert( test_negative_shifts<UInt>() );
return true;
}
@@ -125,6 +129,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))0 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))0 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))0 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
#include <cstddef>
static_assert( test( (std::byte)0 ).did_not_match() );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.shift/shl.cc 2026-09-11 21:19:21.079014542 +0200
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.shift/shl.cc 2026-11-11 21:39:13.026921941 +0100
@@ -36,36 +36,45 @@ test(Int x, SInt y)
static_assert( std::shl((Int)0, (SInt)8) == 0 );
static_assert( std::shl((Int)0, (SInt)-4) == 0 );
static_assert( std::shl((Int)-1, (SInt)0) == (Int)((Int)-1 << 0) );
- static_assert( std::shl((Int)-1, (SInt)1) == (Int)((Int)-1 << 1) );
- static_assert( std::shl((Int)-1, (SInt)4) == (Int)((Int)-1 << 4) );
- static_assert( std::shl((Int)-1, (SInt)8) == (Int)((Int)-1 << 8) );
- static_assert( std::shl((Int)-1, (SInt)-4)
- == ((SInt)-4 < 0 ? (Int)-1 >> (SInt)4
- : (SInt)-4 >= digits ? 0
- : (Int)((Int)-1 << ((SInt)-4 < 0 ? 0 : (SInt)-4))) );
+ if constexpr (std::numeric_limits<Int>::digits >= 8)
+ {
+ static_assert( std::shl((Int)-1, (SInt)1) == (Int)((Int)-1 << 1) );
+ static_assert( std::shl((Int)-1, (SInt)4) == (Int)((Int)-1 << 4) );
+ static_assert( std::shl((Int)-1, (SInt)8) == (Int)((Int)-1 << 8) );
+ static_assert( std::shl((Int)-1, (SInt)-4)
+ == ((SInt)-4 < 0 ? (Int)-1 >> (SInt)4
+ : (SInt)-4 >= digits ? 0
+ : (Int)((Int)-1 << ((SInt)-4 < 0 ? 0 : (SInt)-4))) );
+ }
static_assert( std::shl((Int)1, (SInt)0) == (Int)1 << 0 );
- static_assert( std::shl((Int)1, (SInt)1) == (Int)1 << 1 );
- static_assert( std::shl((Int)1, (SInt)4) == (Int)1 << 4 );
+ if constexpr (std::numeric_limits<Int>::digits >= 8)
+ {
+ static_assert( std::shl((Int)1, (SInt)1) == (Int)1 << 1 );
+ static_assert( std::shl((Int)1, (SInt)4) == (Int)1 << 4 );
+ }
static_assert( std::shl((Int)1, (SInt)digits) == (Int)0 );
static_assert( std::shl((Int)7, (SInt)digits) == (Int)0 );
static_assert( std::shl((Int)6, (SInt)digits - 1) == (Int)0 );
- static_assert( std::shl((Int)3, (SInt)6) == (Int)((Int)3 << 6) );
+ if constexpr (std::numeric_limits<Int>::digits >= 8)
+ {
+ static_assert( std::shl((Int)3, (SInt)6) == (Int)((Int)3 << 6) );
- static_assert( std::shl((Int)0b0110'1100, (SInt)1) == (Int)0b1101'1000 );
- static_assert( std::shl((Int)0b0110'1100, (SInt)digits - 1) == 0 );
+ static_assert( std::shl((Int)0b0110'1100, (SInt)1) == (Int)0b1101'1000 );
+ static_assert( std::shl((Int)0b0110'1100, (SInt)digits - 1) == 0 );
- static_assert( std::shl((Int)0x01, (SInt)0 ) == 0x01 );
- static_assert( std::shl((Int)0x10, (SInt)0 ) == 0x10 );
- static_assert( std::shl((Int)0x10, (SInt)1 ) == 0x20 );
- static_assert( std::shl((Int)0x10, (SInt)2 ) == 0x40 );
- static_assert( std::shl((Int)0x10, (SInt)3 ) == (Int)0x80 );
- static_assert( std::shl((Int)0x11, (SInt)1 ) == 0x22 );
- static_assert( std::shl((Int)0x11, (SInt)2 ) == 0x44 );
- static_assert( std::shl((Int)0x11, (SInt)-2 )
- == ((SInt)-2 < 0 ? 4
- : (SInt)-2 >= digits ? 0
- : (Int)0x11 << ((SInt)-2 < 0 ? 0 : (SInt)-2)) );
+ static_assert( std::shl((Int)0x01, (SInt)0 ) == 0x01 );
+ static_assert( std::shl((Int)0x10, (SInt)0 ) == 0x10 );
+ static_assert( std::shl((Int)0x10, (SInt)1 ) == 0x20 );
+ static_assert( std::shl((Int)0x10, (SInt)2 ) == 0x40 );
+ static_assert( std::shl((Int)0x10, (SInt)3 ) == (Int)0x80 );
+ static_assert( std::shl((Int)0x11, (SInt)1 ) == 0x22 );
+ static_assert( std::shl((Int)0x11, (SInt)2 ) == 0x44 );
+ static_assert( std::shl((Int)0x11, (SInt)-2 )
+ == ((SInt)-2 < 0 ? 4
+ : (SInt)-2 >= digits ? 0
+ : (Int)0x11 << ((SInt)-2 < 0 ? 0 : (SInt)-2)) );
+ }
if constexpr (std::numeric_limits<Int>::digits > 8)
{
@@ -73,7 +82,9 @@ test(Int x, SInt y)
static_assert( std::shl((Int)0b1010'0101, (SInt)4) == 0b1010'0101'0000 );
}
- if constexpr (std::is_signed_v<SInt>)
+ if constexpr (std::is_signed_v<SInt>
+ && (std::numeric_limits<Int>::digits + std::is_signed_v<Int>
+ >= 8))
static_assert( test_negative_shifts<Int, SInt>() );
return true;
@@ -148,6 +159,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0, 0U ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0, 0 ) );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0, 0 ) );
+static_assert( test( (_BitInt(1))0, 0 ) );
+static_assert( test( (unsigned _BitInt(37))0, 0 ) );
+static_assert( test( (_BitInt(37))0, 0 ) );
+static_assert( test( (unsigned _BitInt(64))0, 0 ) );
+static_assert( test( (_BitInt(64))0, 0 ) );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0, 0 ) );
+static_assert( test( (_BitInt(256))0, 0 ) );
+static_assert( test( (unsigned _BitInt(575))0, 0 ) );
+static_assert( test( (_BitInt(575))0, 0 ) );
+#endif
+#endif
static_assert( std::shl(-1, 0x7fffffff00000001LL) == 0 );
static_assert( std::shl(2, 0x7fffffff00000001LL) == 0 );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.shift/shr.cc 2026-09-11 21:19:21.079014542 +0200
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.shift/shr.cc 2026-11-11 21:39:13.027054258 +0100
@@ -36,36 +36,48 @@ test(Int x, SInt y)
static_assert( std::shr((Int)0, (SInt)8) == 0 );
static_assert( std::shr((Int)0, (SInt)-4) == 0 );
static_assert( std::shr((Int)-1, (SInt)0) == (Int)((Int)-1 >> 0) );
- static_assert( std::shr((Int)-1, (SInt)1) == (Int)((Int)-1 >> 1) );
- static_assert( std::shr((Int)-1, (SInt)4) == (Int)((Int)-1 >> 4) );
- static_assert( std::shr((Int)-1, (SInt)8) == (Int)((Int)-1 >> 8) );
- static_assert( std::shr((Int)-1, (SInt)-4)
- == ((SInt)-4 < 0 ? (Int)((Int)-1 << (SInt)4)
- : (SInt)-4 >= digits ? ((Int)-1 < 0 ? (Int)-1 : 0)
- : (Int)((Int)-1 >> ((SInt)-4 < 0 ? 0 : (SInt)-4))) );
+ if constexpr (std::numeric_limits<Int>::digits >= 8)
+ {
+ static_assert( std::shr((Int)-1, (SInt)1) == (Int)((Int)-1 >> 1) );
+ static_assert( std::shr((Int)-1, (SInt)4) == (Int)((Int)-1 >> 4) );
+ static_assert( std::shr((Int)-1, (SInt)8) == (Int)((Int)-1 >> 8) );
+ static_assert( std::shr((Int)-1, (SInt)-4)
+ == ((SInt)-4 < 0 ? (Int)((Int)-1 << (SInt)4)
+ : (SInt)-4 >= digits ? ((Int)-1 < 0 ? (Int)-1 : 0)
+ : (Int)((Int)-1 >> ((SInt)-4 < 0 ? 0 : (SInt)-4))) );
+ }
static_assert( std::shr((Int)1, (SInt)0) == (Int)1 >> 0 );
- static_assert( std::shr((Int)1, (SInt)1) == (Int)1 >> 1 );
- static_assert( std::shr((Int)1, (SInt)4) == (Int)1 >> 4 );
- static_assert( std::shr((Int)1, (SInt)digits) == (Int)0 );
- static_assert( std::shr((Int)7, (SInt)digits) == (Int)0 );
+ if constexpr (std::numeric_limits<Int>::digits >= 8)
+ {
+ static_assert( std::shr((Int)1, (SInt)1) == (Int)1 >> 1 );
+ static_assert( std::shr((Int)1, (SInt)4) == (Int)1 >> 4 );
+ }
+ if constexpr (std::numeric_limits<Int>::digits > 1)
+ {
+ static_assert( std::shr((Int)1, (SInt)digits) == (Int)0 );
+ static_assert( std::shr((Int)7, (SInt)digits) == (Int)0 );
+ }
static_assert( std::shr((Int)6, (SInt)digits - 1) == (Int)0 );
- static_assert( std::shr((Int)3, (SInt)6) == (Int)((Int)3 >> 6) );
+ if constexpr (std::numeric_limits<Int>::digits >= 8)
+ {
+ static_assert( std::shr((Int)3, (SInt)6) == (Int)((Int)3 >> 6) );
- static_assert( std::shr((Int)0b0110'1100, (SInt)1) == (Int)0b0011'0110 );
- static_assert( std::shr((Int)0b0110'1100, (SInt)digits - 1) == 0 );
+ static_assert( std::shr((Int)0b0110'1100, (SInt)1) == (Int)0b0011'0110 );
+ static_assert( std::shr((Int)0b0110'1100, (SInt)digits - 1) == 0 );
- static_assert( std::shr((Int)0x01, (SInt)0 ) == 0x01 );
- static_assert( std::shr((Int)0x10, (SInt)0 ) == 0x10 );
- static_assert( std::shr((Int)0x10, (SInt)1 ) == 0x08 );
- static_assert( std::shr((Int)0x10, (SInt)2 ) == 0x04 );
- static_assert( std::shr((Int)0x10, (SInt)3 ) == 0x02 );
- static_assert( std::shr((Int)0x22, (SInt)1 ) == 0x11 );
- static_assert( std::shr((Int)0x22, (SInt)2 ) == 0x08 );
- static_assert( std::shr((Int)0x11, (SInt)-2 )
- == ((SInt)-2 < 0 ? 0x44
- : (SInt)-2 >= digits ? 0
- : (Int)0x11 >> ((SInt)-2 < 0 ? 0 : (SInt)-2)) );
+ static_assert( std::shr((Int)0x01, (SInt)0 ) == 0x01 );
+ static_assert( std::shr((Int)0x10, (SInt)0 ) == 0x10 );
+ static_assert( std::shr((Int)0x10, (SInt)1 ) == 0x08 );
+ static_assert( std::shr((Int)0x10, (SInt)2 ) == 0x04 );
+ static_assert( std::shr((Int)0x10, (SInt)3 ) == 0x02 );
+ static_assert( std::shr((Int)0x22, (SInt)1 ) == 0x11 );
+ static_assert( std::shr((Int)0x22, (SInt)2 ) == 0x08 );
+ static_assert( std::shr((Int)0x11, (SInt)-2 )
+ == ((SInt)-2 < 0 ? 0x44
+ : (SInt)-2 >= digits ? 0
+ : (Int)0x11 >> ((SInt)-2 < 0 ? 0 : (SInt)-2)) );
+ }
if constexpr (std::numeric_limits<Int>::digits > 8)
{
@@ -73,7 +85,9 @@ test(Int x, SInt y)
static_assert( std::shr((Int)0b1'1011'1000, (SInt)4) == 0b0001'1011 );
}
- if constexpr (std::is_signed_v<SInt>)
+ if constexpr (std::is_signed_v<SInt>
+ && (std::numeric_limits<Int>::digits + std::is_signed_v<Int>
+ >= 8))
static_assert( test_negative_shifts<Int, SInt>() );
return true;
@@ -148,6 +162,20 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)0, 0U ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0, 0 ) );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))0, 0 ) );
+static_assert( test( (_BitInt(1))0, 0 ) );
+static_assert( test( (unsigned _BitInt(37))0, 0 ) );
+static_assert( test( (_BitInt(37))0, 0 ) );
+static_assert( test( (unsigned _BitInt(64))0, 0 ) );
+static_assert( test( (_BitInt(64))0, 0 ) );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))0, 0 ) );
+static_assert( test( (_BitInt(256))0, 0 ) );
+static_assert( test( (unsigned _BitInt(575))0, 0 ) );
+static_assert( test( (_BitInt(575))0, 0 ) );
+#endif
+#endif
static_assert( std::shr(-1, 0x7fffffff00000001LL) == -1 );
static_assert( std::shr(2, 0x7fffffff00000001LL) == 0 );
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_compress.cc 2026-10-14 22:17:47.557108880 +0200
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_compress.cc 2026-11-11 21:39:13.028155581 +0100
@@ -14,7 +14,8 @@ test(UInt x)
static_assert( std::bit_compress(UInt(0x123456789abcdefull), UInt(~UInt(0))) == UInt(0x123456789abcdefull) );
static_assert( std::bit_compress(UInt(0), UInt(0x123456789abcdefull)) == UInt(0) );
static_assert( std::bit_compress(UInt(~UInt(0)), UInt(~UInt(0))) == UInt(~UInt(0)) );
- static_assert( std::bit_compress(UInt(~UInt(0)), UInt(0x123456789abcdefull)) == (UInt(1) << std::popcount(UInt(0x123456789abcdefull))) - 1 );
+ if constexpr (digits > 1)
+ static_assert( std::bit_compress(UInt(~UInt(0)), UInt(0x123456789abcdefull)) == (UInt(1) << std::popcount(UInt(0x123456789abcdefull))) - 1 );
static_assert( digits < 16 || digits % 2 != 0 || std::bit_compress(std::bit_repeat(UInt(0x1234), 16), std::bit_repeat(UInt(1), 2)) == std::bit_repeat(UInt(0x46), 8) >> (digits / 2) );
static_assert( digits < 16 || digits % 2 != 0 || std::bit_compress(std::bit_repeat(UInt(0x1234), 16), std::bit_repeat(UInt(2), 2)) == std::bit_repeat(UInt(0x14), 8) >> (digits / 2) );
static_assert( digits < 8 || std::bit_compress(UInt(0xff), UInt(0xff)) == UInt(0xff) );
@@ -64,7 +65,7 @@ static_assert( test( (void*)0 ).did_not_
static_assert( test( X{} ).did_not_match() );
enum E : unsigned { e };
static_assert( test( e ).did_not_match() );
-
+
#if !defined(__STRICT_ANSI__) && defined __SIZEOF_INT128__
static_assert( test( (unsigned __int128)3 ) );
static_assert( test( (__int128)0 ).did_not_match() );
@@ -85,3 +86,17 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)1 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))1 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))1 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))1 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))1 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))1 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_expand.cc 2026-10-14 22:17:47.558091890 +0200
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_expand.cc 2026-11-11 21:39:13.028485222 +0100
@@ -14,7 +14,8 @@ test(UInt x)
static_assert( std::bit_expand(UInt(0x123456789abcdefull), UInt(~UInt(0))) == UInt(0x123456789abcdefull) );
static_assert( std::bit_expand(UInt(0), UInt(0x123456789abcdefull)) == UInt(0) );
static_assert( std::bit_expand(UInt(~UInt(0)), UInt(~UInt(0))) == UInt(~UInt(0)) );
- static_assert( std::bit_expand(UInt((UInt(1) << std::popcount(UInt(0x123456789abcdefull))) - 1), UInt(0x123456789abcdefull)) == UInt(0x123456789abcdefull) );
+ if constexpr (digits > 1)
+ static_assert( std::bit_expand(UInt((UInt(1) << std::popcount(UInt(0x123456789abcdefull))) - 1), UInt(0x123456789abcdefull)) == UInt(0x123456789abcdefull) );
static_assert( digits < 16 || std::bit_expand(std::bit_repeat(UInt(0x46), 8), std::bit_repeat(UInt(1), 2)) == std::bit_repeat(UInt(0x1014), 16) );
static_assert( digits < 16 || std::bit_expand(std::bit_repeat(UInt(0x14), 8), std::bit_repeat(UInt(2), 2)) == std::bit_repeat(UInt(0x0220), 16) );
static_assert( digits < 8 || std::bit_expand(UInt(0xff), UInt(0xff)) == UInt(0xff) );
@@ -64,7 +65,7 @@ static_assert( test( (void*)0 ).did_not_
static_assert( test( X{} ).did_not_match() );
enum E : unsigned { e };
static_assert( test( e ).did_not_match() );
-
+
#if !defined(__STRICT_ANSI__) && defined __SIZEOF_INT128__
static_assert( test( (unsigned __int128)3 ) );
static_assert( test( (__int128)0 ).did_not_match() );
@@ -85,3 +86,17 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)1 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))1 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))1 ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))1 ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))1 ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))1 ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_repeat.cc 2026-10-14 22:17:47.558091890 +0200
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_repeat.cc 2026-11-11 21:39:13.028621067 +0100
@@ -102,7 +102,7 @@ static_assert( test( (void*)0 ).did_not_
static_assert( test( X{} ).did_not_match() );
enum E : unsigned { e };
static_assert( test( e ).did_not_match() );
-
+
#if !defined(__STRICT_ANSI__) && defined __SIZEOF_INT128__
static_assert( test( (unsigned __int128)3 ) );
static_assert( test( (__int128)0 ).did_not_match() );
@@ -123,3 +123,17 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)1 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))1 ) );
+static_assert( test( (_BitInt(1))1 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))1 ) );
+static_assert( test( (_BitInt(37))1 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))1 ) );
+static_assert( test( (_BitInt(64))1 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))1 ) );
+static_assert( test( (_BitInt(256))1 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))1 ) );
+static_assert( test( (_BitInt(575))1 ).did_not_match() );
+#endif
+#endif
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_reverse.cc 2026-10-14 22:17:47.558091890 +0200
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.permute/bit_reverse.cc 2026-11-11 21:39:13.028716317 +0100
@@ -50,7 +50,7 @@ static_assert( test( (void*)0 ).did_not_
static_assert( test( X{} ).did_not_match() );
enum E : unsigned { e };
static_assert( test( e ).did_not_match() );
-
+
#if !defined(__STRICT_ANSI__) && defined __SIZEOF_INT128__
static_assert( test( (unsigned __int128)3 ) );
static_assert( test( (__int128)0 ).did_not_match() );
@@ -71,3 +71,17 @@ static_assert( test( (__GLIBCXX_TYPE_INT
static_assert( test( (unsigned __GLIBCXX_TYPE_INT_N_3)1 ) );
static_assert( test( (__GLIBCXX_TYPE_INT_N_3)0 ).did_not_match() );
#endif
+#ifdef __BITINT_MAXWIDTH__
+static_assert( test( (unsigned _BitInt(1))1 ) );
+static_assert( test( (_BitInt(1))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(37))11058565729ULL ) );
+static_assert( test( (_BitInt(37))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(64))11058565729ULL ) );
+static_assert( test( (_BitInt(64))0 ).did_not_match() );
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert( test( (unsigned _BitInt(256))11058565729ULL ) );
+static_assert( test( (_BitInt(256))0 ).did_not_match() );
+static_assert( test( (unsigned _BitInt(575))11058565729ULL ) );
+static_assert( test( (_BitInt(575))0 ).did_not_match() );
+#endif
+#endif
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/bitint.cc 2026-11-13 12:48:23.152232831 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/bitint.cc 2026-11-13 12:56:26.570651694 +0100
@@ -0,0 +1,52 @@
+// { dg-do compile { target bitint } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+template<typename T> T same_type(T, T) { return T(); }
+
+static void
+test01()
+{
+ same_type(std::acos(_BitInt(17)(1)), 1.0);
+ same_type(std::asin((unsigned _BitInt(19))(0)), 1.0);
+ same_type(std::atan(_BitInt(38)(0)), 1.0);
+ same_type(std::cos((unsigned _BitInt(52))(0)), 1.0);
+ same_type(std::sin(_BitInt(61)(0)), 1.0);
+ same_type(std::tan((unsigned _BitInt(62))(0)), 1.0);
+#if __BITINT_MAXWIDTH__ >= 575
+ same_type(std::acosh(_BitInt(128)(1)), 1.0);
+ same_type(std::asinh((unsigned _BitInt(128))(0)), 1.0);
+ same_type(std::atanh(_BitInt(175)(0)), 1.0);
+ same_type(std::cosh((unsigned _BitInt(182))(0)), 1.0);
+ same_type(std::sinh(_BitInt(231)(0)), 1.0);
+ same_type(std::tanh((unsigned _BitInt(238))(0)), 1.0);
+ same_type(std::exp(_BitInt(279)(0)), 1.0);
+ same_type(std::exp2((unsigned _BitInt(281))(0)), 1.0);
+ same_type(std::expm1(_BitInt(321)(1)), 1.0);
+ same_type(std::log((unsigned _BitInt(322))(1)), 1.0);
+ same_type(std::log10(_BitInt(450)(1)), 1.0);
+ same_type(std::log1p((unsigned _BitInt(451))(0)), 1.0);
+ same_type(std::log2(_BitInt(512)(1)), 1.0);
+ same_type(std::logb((unsigned _BitInt(512))(1)), 1.0);
+ same_type(std::cbrt(_BitInt(523)(0)), 1.0);
+ same_type(std::fabs((unsigned _BitInt(535))(0)), 1.0);
+ same_type(std::sqrt(_BitInt(575)(1)), 1.0);
+#endif
+#if __BITINT_MAXWIDTH__ >= 2048
+ same_type(std::erf(_BitInt(825)(0)), 1.0);
+ same_type(std::erfc((unsigned _BitInt(999))(0)), 1.0);
+ same_type(std::lgamma(_BitInt(1050)(1)), 1.0);
+ same_type(std::tgamma((unsigned _BitInt(1066))(1)), 1.0);
+ same_type(std::ceil(_BitInt(1212)(0)), 1.0);
+ same_type(std::floor((unsigned _BitInt(1357))(0)), 1.0);
+ same_type(std::nearbyint(_BitInt(1618)(0)), 1.0);
+ same_type(std::rint((unsigned _BitInt(1789))(0)), 1.0);
+ same_type(std::round(_BitInt(1848)(0)), 1.0);
+ same_type(std::trunc((unsigned _BitInt(2048))(0)), 1.0);
+#endif
+}
+
+int
+main()
+{
+ test01();
+}
--- a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/bitint.cc 2026-11-13 12:05:50.741810547 +0100
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/bitint.cc 2026-11-13 12:57:56.244435692 +0100
@@ -0,0 +1,44 @@
+// { dg-do run { target bitint } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <cstdlib>
+
+template<typename T> T same_type(T, T) { return T(); }
+
+_BitInt(37) a = 0;
+_BitInt(37) b = same_type(std::abs(a), a);
+#if __BITINT_MAXWIDTH__ >= 128
+_BitInt(128) c = 0;
+_BitInt(128) d = same_type(std::abs(c), c);
+#endif
+#if __BITINT_MAXWIDTH__ >= 575
+_BitInt(575) e = 0;
+_BitInt(575) f = same_type(std::abs(e), e);
+#endif
+#if __BITINT_MAXWIDTH__ >= 65535
+_BitInt(65535) g = 0;
+_BitInt(65535) h = same_type(std::abs(g), g);
+#endif
+
+#include <testsuite_hooks.h>
+
+static void
+test01()
+{
+ VERIFY( std::abs(2869609811858286945wb) == 2869609811858286945wb );
+ VERIFY( std::abs(-2869609811858286945wb) == 2869609811858286945wb );
+#if __BITINT_MAXWIDTH__ >= 128
+ VERIFY( std::abs(142355028782486672176790405116224704084wb) == 142355028782486672176790405116224704084wb );
+ VERIFY( std::abs(-142355028782486672176790405116224704084wb) == 142355028782486672176790405116224704084wb );
+#endif
+#if __BITINT_MAXWIDTH__ >= 575
+ VERIFY( std::abs(32791610955417207670259616446445237866214208798541489025187667086824759786047937358600830733934317061705991407488315217292688052350226689245651777244910167198919483124190347wb) == 32791610955417207670259616446445237866214208798541489025187667086824759786047937358600830733934317061705991407488315217292688052350226689245651777244910167198919483124190347wb );
+ VERIFY( std::abs(-32791610955417207670259616446445237866214208798541489025187667086824759786047937358600830733934317061705991407488315217292688052350226689245651777244910167198919483124190347wb) == 32791610955417207670259616446445237866214208798541489025187667086824759786047937358600830733934317061705991407488315217292688052350226689245651777244910167198919483124190347wb );
+#endif
+}
+
+int
+main()
+{
+ test01();
+}
--- a/libstdc++-v3/testsuite/std/concepts/concepts.lang/concept.arithmetic/bitint.cc 2026-11-11 21:39:13.030219246 +0100
+++ b/libstdc++-v3/testsuite/std/concepts/concepts.lang/concept.arithmetic/bitint.cc 2026-11-13 10:42:08.119993884 +0100
@@ -0,0 +1,45 @@
+// { dg-do compile { target { c++20 && bitint } } }
+// { dg-additional-options "-Wno-c++29-extensions" { target c++26_down } }
+
+#include <concepts>
+
+static_assert(std::integral<_BitInt(1)>);
+static_assert(std::integral<unsigned _BitInt(1)>);
+static_assert(std::integral<signed _BitInt(23)>);
+static_assert(std::integral<unsigned _BitInt(39)>);
+static_assert(std::integral<signed _BitInt(61)>);
+static_assert(std::integral<unsigned _BitInt(59)>);
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(std::integral<signed _BitInt(574)>);
+static_assert(std::integral<unsigned _BitInt(575)>);
+#endif
+static_assert(std::signed_integral<_BitInt(1)>);
+static_assert(!std::signed_integral<unsigned _BitInt(1)>);
+static_assert(std::signed_integral<signed _BitInt(23)>);
+static_assert(!std::signed_integral<unsigned _BitInt(39)>);
+static_assert(std::signed_integral<signed _BitInt(61)>);
+static_assert(!std::signed_integral<unsigned _BitInt(59)>);
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(std::signed_integral<signed _BitInt(574)>);
+static_assert(!std::signed_integral<unsigned _BitInt(575)>);
+#endif
+static_assert(!std::unsigned_integral<_BitInt(1)>);
+static_assert(std::unsigned_integral<unsigned _BitInt(1)>);
+static_assert(!std::unsigned_integral<signed _BitInt(23)>);
+static_assert(std::unsigned_integral<unsigned _BitInt(39)>);
+static_assert(!std::unsigned_integral<signed _BitInt(61)>);
+static_assert(std::unsigned_integral<unsigned _BitInt(59)>);
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(!std::unsigned_integral<signed _BitInt(574)>);
+static_assert(std::unsigned_integral<unsigned _BitInt(575)>);
+#endif
+static_assert(!std::floating_point<_BitInt(1)>);
+static_assert(!std::floating_point<unsigned _BitInt(1)>);
+static_assert(!std::floating_point<signed _BitInt(23)>);
+static_assert(!std::floating_point<unsigned _BitInt(39)>);
+static_assert(!std::floating_point<signed _BitInt(61)>);
+static_assert(!std::floating_point<unsigned _BitInt(59)>);
+#if __BITINT_MAXWIDTH__ >= 575
+static_assert(!std::floating_point<signed _BitInt(574)>);
+static_assert(!std::floating_point<unsigned _BitInt(575)>);
+#endif
Jakub
More information about the Libstdc++
mailing list