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 {
163163 return !getValue ().isNonNegative ();
164164 return false ;
165165 }
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+ }
168176 static constexpr bool isSigned () { return Signed; }
169177 bool isMinusOne () const { return Signed && getValue ().isAllOnes (); }
170178
Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ static_assert(DivA / DivB == 2, "");
4848constexpr _BitInt (4 ) DivC = DivA / 0; // both-error {{must be initialized by a constant expression}} \
4949 // both-note {{division by zero}}
5050
51+ constexpr __int128 isMinDiv () {
52+ return __int128{0 } / __int128{-1 };
53+ }
54+ static_assert (isMinDiv() == 0 , " " );
55+
56+
57+
5158constexpr _BitInt (7 ) RemA = 47;
5259constexpr _BitInt (6 ) RemB = 9;
5360static_assert (RemA % RemB == 2 , " " );
You can’t perform that action at this time.
0 commit comments