Trait isla_lib::bitvector::BV[][src]

pub trait BV where
    Self: Debug + LowerHex + UpperHex + Display,
    Self: Copy + Clone + PartialEq + Eq + Hash + Send + Sync,
    Self: Serialize + DeserializeOwned,
    Self: Add<Output = Self>,
    Self: Sub<Output = Self>,
    Self: BitAnd<Output = Self>,
    Self: BitOr<Output = Self>,
    Self: BitXor<Output = Self>,
    Self: Not<Output = Self>,
    Self: Neg<Output = Self>,
    Self: Shl<Output = Self>,
    Self: Shr<Output = Self>,
    Self: TryInto<u64, Error = ExecError>, 
{ const BIT_ONE: Self; const BIT_ZERO: Self; const MAX_WIDTH: u32; fn new(value: u64, len: u32) -> Self;
fn len(self) -> u32;
fn lower_u64(self) -> u64;
fn lower_u8(self) -> u8;
fn is_zero(self) -> bool;
fn zeros(len: u32) -> Self;
fn ones(len: u32) -> Self;
fn leading_zeros(self) -> u32;
fn from_u8(value: u8) -> Self;
fn from_u16(value: u16) -> Self;
fn from_u32(value: u32) -> Self;
fn from_u64(value: u64) -> Self;
fn from_bytes(bytes: &[u8]) -> Self;
fn to_le_bytes(self) -> Vec<u8>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
;
fn to_be_bytes(self) -> Vec<u8>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
;
fn from_str(bv: &str) -> Option<Self>;
fn add_i128(self, op: i128) -> Self;
fn zero_extend(self, new_len: u32) -> Self;
fn sign_extend(self, new_len: u32) -> Self;
fn unsigned(self) -> i128;
fn signed(self) -> i128;
fn slice(self, from: u32, len: u32) -> Option<Self>;
fn set_slice(self, n: u32, update: Self) -> Self;
fn set_slice_int(int: i128, n: u32, update: Self) -> i128;
fn get_slice_int(len: u32, int: i128, n: u32) -> Self; fn len_i128(self) -> i128 { ... }
fn is_empty(self) -> bool { ... }
fn sub_i128(self, op: i128) -> Self { ... }
fn append(self, suffix: Self) -> Option<Self> { ... }
fn extract(self, high: u32, low: u32) -> Option<Self> { ... }
fn shiftr(self, shift: i128) -> Self { ... }
fn arith_shiftr(self, shift: i128) -> Self { ... }
fn shiftl(self, shift: i128) -> Self { ... }
fn truncate_lsb(self, len: i128) -> Option<Self> { ... }
fn replicate(self, times: i128) -> Option<Self> { ... } }

This trait allows us to be generic over the representation of concrete bitvectors. Specific users of isla-lib may then choose different representations depending on use case - B64 will likely be the most efficient for ordinary use, but B129 can represent CHERI compressed capabilities concretely.

Associated Constants

const BIT_ONE: Self[src]

const BIT_ZERO: Self[src]

const MAX_WIDTH: u32[src]

In Isla concrete bitvectors are only represented up to a specific maximum width/length. Beyond this they will be promoted to symbolic variables which are equal to a concrete value represented in the SMT solver. This makes computation over concrete bitvectors below this max width very efficient, as they can be represented as simple Copy types like u64.

Loading content...

Required methods

fn new(value: u64, len: u32) -> Self[src]

fn len(self) -> u32[src]

fn lower_u64(self) -> u64[src]

fn lower_u8(self) -> u8[src]

fn is_zero(self) -> bool[src]

fn zeros(len: u32) -> Self[src]

Make a small bitvector of all zeros.

Panics

len must be less than or equal to MAX_WIDTH

fn ones(len: u32) -> Self[src]

Make a small bitvector of all ones.

Panics

len must be less than or equal to MAX_WIDTH

fn leading_zeros(self) -> u32[src]

fn from_u8(value: u8) -> Self[src]

fn from_u16(value: u16) -> Self[src]

fn from_u32(value: u32) -> Self[src]

fn from_u64(value: u64) -> Self[src]

fn from_bytes(bytes: &[u8]) -> Self[src]

Byte order is: from_bytes(&[0xAB, 0xCD, 0xEF] == 0xABCDEF

Panics

bytes.len() * 8 must be less than or equal to MAX_WIDTH

fn to_le_bytes(self) -> Vec<u8>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

fn to_be_bytes(self) -> Vec<u8>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

fn from_str(bv: &str) -> Option<Self>[src]

Parses a bitvector from a string slice. String must be prefixed by either #x/0x, or #b/0b (allowing both SMT style and Sail/C style prefixes) for hexadecimal or binary. Returns None if the string is not parseable for any reason

fn add_i128(self, op: i128) -> Self[src]

fn zero_extend(self, new_len: u32) -> Self[src]

zero_extend a bitvector to a specific new length.

Panics

new_len must be greater than the current length, but less than MAX_WIDTH.

fn sign_extend(self, new_len: u32) -> Self[src]

sign_extend a bitvector to a specific new length. Sign extending a zero-length bitvector creates a new_len sized bitvector containing only zeros.

Panics

new_len must be greater than the current length, but less than MAX_WIDTH.

fn unsigned(self) -> i128[src]

fn signed(self) -> i128[src]

fn slice(self, from: u32, len: u32) -> Option<Self>[src]

fn set_slice(self, n: u32, update: Self) -> Self[src]

fn set_slice_int(int: i128, n: u32, update: Self) -> i128[src]

fn get_slice_int(len: u32, int: i128, n: u32) -> Self[src]

Loading content...

Provided methods

fn len_i128(self) -> i128[src]

fn is_empty(self) -> bool[src]

fn sub_i128(self, op: i128) -> Self[src]

fn append(self, suffix: Self) -> Option<Self>[src]

fn extract(self, high: u32, low: u32) -> Option<Self>[src]

fn shiftr(self, shift: i128) -> Self[src]

fn arith_shiftr(self, shift: i128) -> Self[src]

fn shiftl(self, shift: i128) -> Self[src]

fn truncate_lsb(self, len: i128) -> Option<Self>[src]

fn replicate(self, times: i128) -> Option<Self>[src]

Loading content...

Implementors

impl BV for B64[src]

impl BV for B129[src]

Loading content...