@@ -78,7 +78,8 @@ template <bool Signed> class IntegralAP final {
78
78
79
79
template <typename T> static IntegralAP from (T Value, unsigned NumBits = 0 ) {
80
80
assert (NumBits > 0 );
81
- APSInt Copy = APSInt (APInt (NumBits, static_cast <int64_t >(Value), Signed), !Signed);
81
+ APSInt Copy =
82
+ APSInt (APInt (NumBits, static_cast <uint64_t >(Value), Signed), !Signed);
82
83
83
84
return IntegralAP<Signed>(Copy);
84
85
}
@@ -97,16 +98,16 @@ template <bool Signed> class IntegralAP final {
97
98
template <unsigned Bits, bool InputSigned>
98
99
static IntegralAP from (Integral<Bits, InputSigned> I, unsigned BitWidth) {
99
100
APSInt Copy =
100
- APSInt (APInt (BitWidth, static_cast <int64_t >(I), InputSigned), !Signed);
101
+ APSInt (APInt (BitWidth, static_cast <uint64_t >(I), InputSigned), !Signed);
101
102
Copy.setIsSigned (Signed);
102
103
103
104
assert (Copy.isSigned () == Signed);
104
105
return IntegralAP<Signed>(Copy);
105
106
}
106
107
107
- static IntegralAP zero () {
108
- assert ( false );
109
- return IntegralAP (0 );
108
+ static IntegralAP zero (int32_t BitWidth ) {
109
+ APSInt V = APSInt ( APInt (BitWidth, 0LL , Signed), !Signed );
110
+ return IntegralAP (V );
110
111
}
111
112
112
113
constexpr unsigned bitWidth () const { return V.getBitWidth (); }
0 commit comments