File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,16 @@ template <bool Signed> class IntegralAP final {
163
163
return !getValue ().isNonNegative ();
164
164
return false ;
165
165
}
166
- bool isMin () const { return getValue ().isMinValue (); }
167
- bool isMax () const { return getValue ().isMaxValue (); }
166
+ bool isMin () const {
167
+ if constexpr (Signed)
168
+ return getValue ().isMinSignedValue ();
169
+ return getValue ().isMinValue ();
170
+ }
171
+ bool isMax () const {
172
+ if constexpr (Signed)
173
+ return getValue ().isMaxSignedValue ();
174
+ return getValue ().isMaxValue ();
175
+ }
168
176
static constexpr bool isSigned () { return Signed; }
169
177
bool isMinusOne () const { return Signed && getValue ().isAllOnes (); }
170
178
Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ static_assert(DivA / DivB == 2, "");
48
48
constexpr _BitInt (4 ) DivC = DivA / 0; // both-error {{must be initialized by a constant expression}} \
49
49
// both-note {{division by zero}}
50
50
51
+ constexpr __int128 isMinDiv () {
52
+ return __int128{0 } / __int128{-1 };
53
+ }
54
+ static_assert (isMinDiv() == 0, "");
55
+
56
+
57
+
51
58
constexpr _BitInt (7 ) RemA = 47;
52
59
constexpr _BitInt (6 ) RemB = 9;
53
60
static_assert (RemA % RemB == 2 , " " );
You can’t perform that action at this time.
0 commit comments