File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
flang/include/flang/Common Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1010#define FORTRAN_COMMON_CONSTEXPR_BITSET_H_
1111
1212// Implements a replacement for std::bitset<> that is suitable for use
13- // in constexpr expressions. Limited to elements in [0..63 ].
13+ // in constexpr expressions. Limited to elements in [0..127 ].
1414
1515#include " bit-population-count.h"
16+ #include " uint128.h"
1617#include < cstddef>
1718#include < cstdint>
1819#include < initializer_list>
2223namespace Fortran ::common {
2324
2425template <int BITS> class BitSet {
25- static_assert (BITS > 0 && BITS <= 64 );
26- static constexpr bool partialWord{BITS != 32 && BITS != 64 };
27- using Word = std::conditional_t <(BITS > 32 ), std::uint64_t , std::uint32_t >;
26+ static_assert (BITS > 0 && BITS <= 128 );
27+ using Word = HostUnsignedIntType<(BITS <= 32 ? 32 : BITS)>;
2828 static constexpr Word allBits{
29- partialWord ? ( static_cast <Word>(1 ) << BITS ) - 1 : ~ static_cast <Word>( 0 )};
29+ ~ static_cast <Word>(0 ) >> ( 8 * sizeof (Word ) - BITS )};
3030
3131 constexpr BitSet (Word b) : bits_{b} {}
3232
You can’t perform that action at this time.
0 commit comments