libstdc++: integer-class types as per [iterator.concept.winc]
authorPatrick Palka <ppalka@redhat.com>
Wed, 19 Aug 2020 13:12:55 +0000 (09:12 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 19 Aug 2020 13:12:55 +0000 (09:12 -0400)
commite6c76f0d3327bf00c96f5a63961c1d5ab77512db
treed91a89b40462a25485f34df68cbb15c424feca24
parent708b3600d043e5885ed25464189a88590feeaac9
libstdc++: integer-class types as per [iterator.concept.winc]

This implements signed and unsigned integer-class types, whose width is
one bit larger than the widest supported signed and unsigned integral
type respectively.  In our case this is either __int128 and unsigned
__int128, or long long and unsigned long long.

Internally, the two integer-class types are represented as a largest
supported unsigned integral type plus one extra bit.  The signed
integer-class type is represented in two's complement form with the
extra bit acting as the sign bit.

libstdc++-v3/ChangeLog:

* include/Makefile.am (bits_headers): Add new header
<bits/max_size_type.h>.
* include/Makefile.in: Regenerate.
* include/bits/iterator_concepts.h
(ranges::__detail::__max_diff_type): Remove definition, replace
with forward declaration of class __max_diff_type.
(__detail::__max_size_type): Remove definition, replace with
forward declaration of class __max_size_type.
(__detail::__is_unsigned_int128, __is_signed_int128)
(__is_int128): New concepts.
(__detail::__is_integer_like): Accept __int128 and unsigned
__int128.
(__detail::__is_signed_integer_like): Accept __int128.
* include/bits/max_size_type.h: New header.
* include/bits/range_access.h: Include <bits/max_size_type.h>.
(__detail::__to_unsigned_like): Two new overloads.
* testsuite/std/ranges/iota/difference_type.cc: New test.
* testsuite/std/ranges/iota/max_size_type.cc: New test.
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/iterator_concepts.h
libstdc++-v3/include/bits/max_size_type.h [new file with mode: 0644]
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/testsuite/std/ranges/iota/difference_type.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/ranges/iota/max_size_type.cc [new file with mode: 0644]