@@ -202,26 +202,21 @@ template <unsigned Bits, bool Signed> class Integral final {
202202
203203 static Integral min (unsigned NumBits) { return Integral (Min); }
204204 static Integral max (unsigned NumBits) { return Integral (Max); }
205+ static Integral zero (unsigned BitWidth = 0 ) { return from (0 ); }
205206
206- template <typename ValT> static Integral from (ValT Value) {
207- if constexpr (std::is_integral<ValT>::value)
207+ template <typename ValT>
208+ static Integral from (ValT Value, unsigned NumBits = 0 ) {
209+ if constexpr (std::is_integral_v<ValT>)
208210 return Integral (Value);
209211 else
210- return Integral::from (static_cast <Integral::ReprT>(Value));
212+ return Integral (static_cast <Integral::ReprT>(Value));
211213 }
212214
213215 template <unsigned SrcBits, bool SrcSign>
214- static std::enable_if_t <SrcBits != 0 , Integral>
215- from (Integral<SrcBits, SrcSign> Value) {
216+ static Integral from (Integral<SrcBits, SrcSign> Value) {
216217 return Integral (Value.V );
217218 }
218219
219- static Integral zero (unsigned BitWidth = 0 ) { return from (0 ); }
220-
221- template <typename T> static Integral from (T Value, unsigned NumBits) {
222- return Integral (Value);
223- }
224-
225220 static bool inRange (int64_t Value, unsigned NumBits) {
226221 return CheckRange<ReprT, Min, Max>(Value);
227222 }
0 commit comments