[−][src]Struct falcon::il::Constant
A constant value for Falcon IL
IL Constants in Falcon are backed by both rust's u64
primitive, and
BigUint
from the num-bigint
crate. This allows modelling and simulation
of instructions which must operate on values >64 bits in size. When a
Constant has 64 or less bits, the u64
will be used, incurring minimal
performance overhead.
The Falcon IL Expression operations are provided as methods over Constant
.
Methods
impl Constant
[src]
pub fn new(value: u64, bits: usize) -> Constant
[src]
Create a new Constant
with the given value and bitness.
pub fn new_big(value: BigUint, bits: usize) -> Constant
[src]
Create a new Constant
from the given BigUint
.
pub fn from_decimal_string(s: &String, bits: usize) -> Result<Constant>
[src]
Crates a constant from a decimal string of the value
pub fn new_zero(bits: usize) -> Constant
[src]
Create a new Constant
with the given bits and a value of zero
pub fn value_u64(&self) -> Option<u64>
[src]
Get the value of this Constant
if it is a u64
.
pub fn value_i64(&self) -> Option<i64>
[src]
Sign-extend the constant out to 64-bits, and return it as an i64
pub fn value(&self) -> &BigUint
[src]
Get the value of this Constant
if it is a BigUint
.
pub fn bits(&self) -> usize
[src]
Get the number of bits for this Constant
.
pub fn is_zero(&self) -> bool
[src]
Returns true if the value in this Constant is 0, false otherwise.
pub fn is_one(&self) -> bool
[src]
Returns true if the value in this constant is 1, false otherwise.
pub fn add(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn sub(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn mul(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn divu(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn modu(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn divs(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn mods(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn and(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn or(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn xor(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn shl(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn shr(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn cmpeq(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn cmpneq(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn cmpltu(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn cmplts(&self, rhs: &Constant) -> Result<Constant>
[src]
pub fn trun(&self, bits: usize) -> Result<Constant>
[src]
pub fn zext(&self, bits: usize) -> Result<Constant>
[src]
pub fn sext(&self, bits: usize) -> Result<Constant>
[src]
Trait Implementations
impl Clone for Constant
[src]
impl Debug for Constant
[src]
impl<'de> Deserialize<'de> for Constant
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Constant
[src]
impl Eq for Constant
[src]
impl Hash for Constant
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Into<Expression> for Constant
[src]
fn into(self) -> Expression
[src]
impl Ord for Constant
[src]
fn cmp(&self, other: &Constant) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Constant> for Constant
[src]
impl PartialOrd<Constant> for Constant
[src]
fn partial_cmp(&self, other: &Constant) -> Option<Ordering>
[src]
fn lt(&self, other: &Constant) -> bool
[src]
fn le(&self, other: &Constant) -> bool
[src]
fn gt(&self, other: &Constant) -> bool
[src]
fn ge(&self, other: &Constant) -> bool
[src]
impl Serialize for Constant
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Constant
[src]
impl StructuralPartialEq for Constant
[src]
impl Value for Constant
[src]
fn constant(constant: Constant) -> Self
[src]
fn bits(&self) -> usize
[src]
fn shl(&self, bits: usize) -> Result<Self>
[src]
fn shr(&self, bits: usize) -> Result<Self>
[src]
fn trun(&self, bits: usize) -> Result<Self>
[src]
fn zext(&self, bits: usize) -> Result<Self>
[src]
fn or(&self, other: &Self) -> Result<Self>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Constant
impl Send for Constant
impl Sync for Constant
impl Unpin for Constant
impl UnwindSafe for Constant
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,