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 10
10
#define FORTRAN_COMMON_CONSTEXPR_BITSET_H_
11
11
12
12
// 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 ].
14
14
15
15
#include " bit-population-count.h"
16
+ #include " uint128.h"
16
17
#include < cstddef>
17
18
#include < cstdint>
18
19
#include < initializer_list>
22
23
namespace Fortran ::common {
23
24
24
25
template <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)>;
28
28
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 )};
30
30
31
31
constexpr BitSet (Word b) : bits_{b} {}
32
32
You can’t perform that action at this time.
0 commit comments