forked from libre-chip/fayalite
add IntTypeTrait::literal utility function
This commit is contained in:
parent
8ca0cd56c4
commit
bdfa18e11d
|
@ -887,6 +887,15 @@ pub trait IntTypeTrait:
|
||||||
CanonicalType = DynSIntType,
|
CanonicalType = DynSIntType,
|
||||||
CanonicalValue = DynSInt,
|
CanonicalValue = DynSInt,
|
||||||
>;
|
>;
|
||||||
|
fn literal(self, value: impl Into<BigInt>) -> Expr<IntValue<Self>>
|
||||||
|
where
|
||||||
|
Self: IntTypeTrait<
|
||||||
|
CanonicalType = DynIntType<<Self as IntTypeTrait>::Signed>,
|
||||||
|
CanonicalValue = DynInt<<Self as IntTypeTrait>::Signed>,
|
||||||
|
>,
|
||||||
|
{
|
||||||
|
IntValue::with_type(self, value).to_expr()
|
||||||
|
}
|
||||||
fn from_width_unchecked(width: usize) -> Self;
|
fn from_width_unchecked(width: usize) -> Self;
|
||||||
fn width(self) -> usize;
|
fn width(self) -> usize;
|
||||||
fn as_same_width_uint(self) -> Self::SameWidthUInt;
|
fn as_same_width_uint(self) -> Self::SameWidthUInt;
|
||||||
|
|
Loading…
Reference in a new issue