pub type Bitvector = ApInt;
Expand description

A bitvector is a fixed-length vector of bits with the semantics of a CPU register, i.e. it supports two’s complement modulo arithmetic.

Bitvector is just an alias for the apint::ApInt type.

Aliased Type§

struct Bitvector { /* private fields */ }

Trait Implementations§

source§

impl BitvectorExtended for Bitvector

source§

fn cast(&self, kind: CastOpType, width: ByteSize) -> Result<Self, Error>

Perform a cast operation on the bitvector. Returns an error for non-implemented cast operations (currently all float-related casts).

source§

fn subpiece(&self, low_byte: ByteSize, size: ByteSize) -> Self

Extract a subpiece from the given bitvector.

source§

fn un_op(&self, op: UnOpType) -> Result<Self, Error>

Perform a unary operation on the given bitvector. Returns an error for non-implemented operations (currently all float-related operations).

source§

fn bin_op(&self, op: BinOpType, rhs: &Self) -> Result<Self, Error>

Perform a binary operation on the given bitvectors. Returns an error for non-implemented operations (currently all float-related operations) or for divisions-by-zero.

source§

fn signed_add_overflow_checked(&self, rhs: &Self) -> Option<Self>

Returns the result of self + rhs if the computation does not result in a signed integer overflow or underflow.

source§

fn signed_sub_overflow_checked(&self, rhs: &Self) -> Option<Self>

Returns the result of self - rhs if the computation does not result in a signed integer overflow or underflow.

source§

fn signed_mult_with_overflow_flag( &self, rhs: &Self ) -> Result<(Self, bool), Error>

Return the result of multiplying self with rhs and a flag that is set to true if the multiplication resulted in a signed integer overflow or underflow.

Returns an error for bitvectors larger than 8 bytes, since multiplication for them is not yet implemented in the apint crate.

source§

fn bytesize(&self) -> ByteSize

Return the size in bytes of the bitvector.

source§

fn into_resize_unsigned(self, size: ByteSize) -> Self

Resize self to the target byte size by either zero extending or truncating self.

source§

fn into_resize_signed(self, size: ByteSize) -> Self

Resize self to the target byte size by either sign extending or truncating self.