[][src]Struct llhd::value::IntValue

pub struct IntValue {
    pub width: usize,
    pub value: BigUint,
}

An integer value.

Fields

width: usize

The width of the value in bits.

value: BigUint

The value itself.

Implementations

impl IntValue[src]

pub fn zero(width: usize) -> Self[src]

Create a zero value.

pub fn all_ones(width: usize) -> Self[src]

Create a value with all bits set to one.

pub fn from_usize(width: usize, value: usize) -> Self[src]

Create a new integer value from a usize.

pub fn from_isize(width: usize, value: isize) -> Self[src]

Create a new integer value from an isize.

pub fn from_signed(width: usize, value: BigInt) -> Self[src]

Create a new integer value from a signed BigInt value.

pub fn from_unsigned(width: usize, value: BigUint) -> Self[src]

Create a new integer value from an unsigned BigUint value.

pub fn to_signed(&self) -> BigInt[src]

Convert the value to a signed BigInt.

pub fn to_usize(&self) -> usize[src]

Convert the value to a usize.

pub fn is_zero(&self) -> bool[src]

Check if the value is zero.

pub fn is_one(&self) -> bool[src]

Check if the value is one.

pub fn is_all_ones(&self) -> bool[src]

Check if the value has every bit set to one.

pub fn ty(&self) -> Type[src]

Get the type of the value.

impl IntValue[src]

Slicing.

pub fn extract_slice(&self, off: usize, len: usize) -> IntValue[src]

Extract a slice of bits from the value.

pub fn insert_slice(&mut self, off: usize, len: usize, value: &IntValue)[src]

Insert a slice of bits into the value.

impl IntValue[src]

Unary operators.

pub fn not(&self) -> IntValue[src]

Compute not.

pub fn neg(&self) -> IntValue[src]

Compute neg.

impl IntValue[src]

Binary operators.

pub fn add(&self, other: &Self) -> IntValue[src]

Compute add.

pub fn sub(&self, other: &Self) -> IntValue[src]

Compute sub.

pub fn and(&self, other: &Self) -> IntValue[src]

Compute and.

pub fn or(&self, other: &Self) -> IntValue[src]

Compute or.

pub fn xor(&self, other: &Self) -> IntValue[src]

Compute xor.

pub fn umul(&self, other: &Self) -> IntValue[src]

Compute umul.

pub fn udiv(&self, other: &Self) -> IntValue[src]

Compute udiv.

pub fn umod(&self, other: &Self) -> IntValue[src]

Compute umod.

pub fn urem(&self, other: &Self) -> IntValue[src]

Compute urem.

pub fn smul(&self, other: &Self) -> IntValue[src]

Compute smul.

pub fn sdiv(&self, other: &Self) -> IntValue[src]

Compute sdiv.

pub fn smod(&self, other: &Self) -> IntValue[src]

Compute smod.

pub fn srem(&self, other: &Self) -> IntValue[src]

Compute srem.

impl IntValue[src]

Comparisons.

pub fn eq(&self, other: &Self) -> bool[src]

Compute ==.

pub fn neq(&self, other: &Self) -> bool[src]

Compute !=.

pub fn ult(&self, other: &Self) -> bool[src]

Compute unsigned <.

pub fn ugt(&self, other: &Self) -> bool[src]

Compute unsigned >.

pub fn ule(&self, other: &Self) -> bool[src]

Compute unsigned <=.

pub fn uge(&self, other: &Self) -> bool[src]

Compute unsigned >=.

pub fn slt(&self, other: &Self) -> bool[src]

Compute signed <.

pub fn sgt(&self, other: &Self) -> bool[src]

Compute signed >.

pub fn sle(&self, other: &Self) -> bool[src]

Compute signed <=.

pub fn sge(&self, other: &Self) -> bool[src]

Compute signed >=.

impl IntValue[src]

Opcode implementations.

pub fn try_unary_op(op: Opcode, arg: &IntValue) -> Option<IntValue>[src]

Execute a unary opcode.

pub fn unary_op(op: Opcode, arg: &IntValue) -> IntValue[src]

Execute a unary opcode.

pub fn try_binary_op(
    op: Opcode,
    lhs: &IntValue,
    rhs: &IntValue
) -> Option<IntValue>
[src]

Execute a binary opcode.

pub fn binary_op(op: Opcode, lhs: &IntValue, rhs: &IntValue) -> IntValue[src]

Execute a binary opcode.

pub fn try_compare_op(
    op: Opcode,
    lhs: &IntValue,
    rhs: &IntValue
) -> Option<IntValue>
[src]

Execute a comparison opcode.

pub fn compare_op(op: Opcode, lhs: &IntValue, rhs: &IntValue) -> IntValue[src]

Execute a comparison opcode.

Trait Implementations

impl Clone for IntValue[src]

impl Debug for IntValue[src]

impl<'de> Deserialize<'de> for IntValue[src]

impl Display for IntValue[src]

impl Eq for IntValue[src]

impl From<(usize, BigInt)> for IntValue[src]

impl From<(usize, BigUint)> for IntValue[src]

impl From<(usize, usize)> for IntValue[src]

impl From<IntValue> for Value[src]

impl Hash for IntValue[src]

impl Ord for IntValue[src]

impl PartialEq<IntValue> for IntValue[src]

impl PartialOrd<IntValue> for IntValue[src]

impl Serialize for IntValue[src]

impl StructuralEq for IntValue[src]

impl StructuralPartialEq for IntValue[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: for<'de> 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.