[][src]Struct falcon::il::Constant

pub struct Constant { /* fields omitted */ }

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]

impl Display for Constant[src]

impl Eq for Constant[src]

impl Hash for Constant[src]

impl Into<Expression> for Constant[src]

impl Ord for Constant[src]

impl PartialEq<Constant> for Constant[src]

impl PartialOrd<Constant> for Constant[src]

impl Serialize for Constant[src]

impl StructuralEq for Constant[src]

impl StructuralPartialEq for Constant[src]

impl Value for Constant[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.