Struct apint::APInt
[−]
[src]
pub struct APInt { /* fields omitted */ }
Methods
impl APInt
[src]
fn from_i8(val: i8) -> APInt
[src]
Creates a new APInt
from a given i8
value with a bit-width of 8.
fn from_u8(val: u8) -> APInt
[src]
Creates a new APInt
from a given i8
value with a bit-width of 8.
fn from_i16(val: i16) -> APInt
[src]
Creates a new APInt
from a given i16
value with a bit-width of 16.
fn from_u16(val: u16) -> APInt
[src]
Creates a new APInt
from a given i16
value with a bit-width of 16.
fn from_i32(val: i32) -> APInt
[src]
Creates a new APInt
from a given i32
value with a bit-width of 32.
fn from_u32(val: u32) -> APInt
[src]
Creates a new APInt
from a given i32
value with a bit-width of 32.
fn from_i64(val: i64) -> APInt
[src]
Creates a new APInt
from a given i64
value with a bit-width of 64.
fn from_u64(val: u64) -> APInt
[src]
Creates a new APInt
from a given i64
value with a bit-width of 64.
fn zero(bitwidth: BitWidth) -> APInt
[src]
Creates a new APInt
with the given bit-width that represents zero.
Error Returns InvalidZeroBitWidth
in case of a given target bit-width of zero.
fn one(bitwidth: BitWidth) -> APInt
[src]
Creates a new APInt
with the given bit-width that represents one.
Error Returns InvalidZeroBitWidth
in case of a given target bit-width of zero.
fn zeros(bitwidth: BitWidth) -> APInt
[src]
Creates a new APInt
with the given bit-width that has all bits set.
Error Returns InvalidZeroBitWidth
in case of a given target bit-width of zero.
fn ones(bitwidth: BitWidth) -> APInt
[src]
Creates a new APInt
with the given bit-width that has all bits set.
Error Returns InvalidZeroBitWidth
in case of a given target bit-width of zero.
impl APInt
[src]
fn truncate<W>(&self, target_bitwidth: W) -> Result<APInt> where
W: Into<BitWidth>,
[src]
W: Into<BitWidth>,
Creates a new FixInt
that represents this FixInt
truncated to
the given target bit-width.
Panics
- If
target_bitwidth
is greater than theFixInt
's current bit-width. - If
target_bitwidth
is zero (0
).
Note
Equal to a call to clone()
if target_bitwidth
is equal to this FixInt
's bit-width.
fn zero_extend<W>(&self, target_bitwidth: W) -> Result<APInt> where
W: Into<BitWidth>,
[src]
W: Into<BitWidth>,
Creates a new FixInt
that represents the zero-extension of this FixInt
to the given target bit-width.
Semantics (from LLVM)
The zext fills the high order bits of the value with zero bits until it reaches the size of the destination bit-width.
When zero extending from i1
, the result will always be either 0
or 1
.
Panics
- If
target_bitwidth
is less than theFixInt
's current bit-width.
Note
Equal to a call to clone()
if target_bitwidth
is equal to this FixInt
's bit-width.
fn sign_extend<W>(&self, target_bitwidth: W) -> Result<APInt> where
W: Into<BitWidth>,
[src]
W: Into<BitWidth>,
Creates a new FixInt
that represents the sign-extension of this FixInt
to the given target bit-width.
Semantic (from LLVM)
The ‘sext‘ instruction performs a sign extension by copying the sign bit (highest order bit) of the value until it reaches the target bit-width.
When sign extending from i1
, the extension always results in -1
or 0
.
Panics
- If
target_bitwidth
is less than theFixInt
's current bit-width.
Note
Equal to a call to clone()
if target_bitwidth
is equal to this FixInt
's bit-width.
fn zero_resize<W>(&self, target_bitwidth: W) -> APInt where
W: Into<BitWidth>,
[src]
W: Into<BitWidth>,
TODO: Missing documentation.
fn sign_resize<W>(&self, target_bitwidth: W) -> APInt where
W: Into<BitWidth>,
[src]
W: Into<BitWidth>,
TODO: Missing documentation.
impl APInt
[src]
fn bitnot(&self) -> APInt
[src]
Creates a new bitvev that represents the bitwise-not of the given APInt
.
fn bitnot_inplace(&mut self)
[src]
Flip all bits of the given APInt
inplace.
This operation operates in-place on self
and thus does not require dynamic memory allocation.
fn checked_bitand(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new bitvec that represents the bitwise-and of both given APInt
s.
fn checked_bitand_assign(&mut self, other: &APInt) -> Result<()>
[src]
Computes bitwise-and of self and other and stores the result in self.
This operation operates in-place on self
and thus does not require dynamic memory allocation.
fn checked_bitor(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new bitvec that represents the bitwise-or of both given APInt
s.
fn checked_bitor_assign(&mut self, other: &APInt) -> Result<()>
[src]
Computes bitwise-or of self and other and stores the result in self.
This operation operates in-place on self
and thus does not require dynamic memory allocation.
fn checked_bitxor(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new bitvec that represents the bitwise-xor of both given APInt
s.
fn checked_bitxor_assign(&mut self, other: &APInt) -> Result<()>
[src]
Computes bitwise-xor of self and other and stores the result in self.
This operation operates in-place on self
and thus does not require dynamic memory allocation.
impl APInt
[src]
fn get(&self, n: usize) -> Result<Bit>
[src]
fn sign_bit(&self) -> Bit
[src]
fn set(&mut self, n: usize) -> Result<()>
[src]
fn set_all(&mut self)
[src]
fn unset(&mut self, n: usize) -> Result<()>
[src]
fn unset_all(&mut self)
[src]
fn flip(&mut self, n: usize) -> Result<()>
[src]
fn flip_all(&mut self)
[src]
impl APInt
[src]
fn ult(&self, other: &APInt) -> Result<bool>
[src]
Unsigned less-than comparison with the other bitvec.
fn ule(&self, other: &APInt) -> Result<bool>
[src]
Unsigned less-than-or-equals comparison with the other bitvec.
fn ugt(&self, other: &APInt) -> Result<bool>
[src]
Unsigned greater-than comparison with the other bitvec.
fn uge(&self, other: &APInt) -> Result<bool>
[src]
Unsigned greater-than-or-equals comparison with the other bitvec.
fn slt(&self, other: &APInt) -> Result<bool>
[src]
Signed less-than comparison with the other bitvec.
fn sle(&self, other: &APInt) -> Result<bool>
[src]
Signed less-than-or-equals comparison with the other bitvec.
fn sgt(&self, other: &APInt) -> Result<bool>
[src]
Signed greater-than comparison with the other bitvec.
fn sge(&self, other: &APInt) -> Result<bool>
[src]
Signed greater-than-or-equals comparison with the other bitvec.
impl APInt
[src]
fn negate(&self) -> APInt
[src]
Returns a new APInt
that represents the negation of this APInt
.
This may allocate heap memory!
fn negate_inplace(&mut self)
[src]
Negates this APInt
inplace as if it was a signed integer.
This does not allocate heap memory!
fn checked_add(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the addition of both given APInt
s.
Note
In the low-level bit-wise representation there is no difference between signed and unsigned addition of fixed bit-width integers. (Cite: LLVM)
fn checked_add_assign(&mut self, other: &APInt) -> Result<()>
[src]
fn checked_sub(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the signed subtraction of both given APInt
s.
Note
In the low-level bit-wise representation there is no difference between signed and unsigned subtraction of fixed bit-width integers. (Cite: LLVM)
fn checked_sub_assign(&mut self, other: &APInt) -> Result<()>
[src]
fn checked_mul(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the multiplication of both given APInt
s.
Note
In the low-level bit-wise representation there is no difference between signed and unsigned multiplication of fixed bit-width integers. (Cite: LLVM)
fn checked_mul_assign(&mut self, other: &APInt) -> Result<()>
[src]
fn checked_udiv(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the unsigned multiplication of both given APInt
s.
fn checked_udiv_assign(&mut self, other: &APInt) -> Result<()>
[src]
fn checked_sdiv(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the signed multiplication of both given APInt
s.
fn checked_sdiv_assign(&mut self, other: &APInt) -> Result<()>
[src]
fn checked_urem(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the unsigned remainder of both given APInt
s.
fn checked_urem_assign(&mut self, other: &APInt) -> Result<()>
[src]
fn checked_srem(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the signed remainder of both given APInt
s.
fn checked_srem_assign(&mut self, other: &APInt) -> Result<()>
[src]
impl APInt
[src]
fn checked_shl(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the result of this APInt
left-shifted by the other one.
Errors
- When
self
andother
have different bit-widths.
fn checked_shl_assign(&mut self, other: &APInt) -> Result<()>
[src]
Left-shifts this APInt
by the amount represented by other
.
Errors
- When
self
andother
have different bit-widths.
fn checked_lshr(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the result of this APInt
logically right-shifted by the other one.
Errors
- When
self
andother
have different bit-widths.
fn checked_lshr_assign(&mut self, other: &APInt) -> Result<()>
[src]
Logically right-shifts this APInt
by the amount represented by other
.
Errors
- When
self
andother
have different bit-widths.
fn checked_ashr(&self, other: &APInt) -> Result<APInt>
[src]
Creates a new APInt
that represents the result of this APInt
arithmetically right-shifted by the other one.
Errors
- When
self
andother
have different bit-widths.
fn checked_ashr_assign(&mut self, other: &APInt) -> Result<()>
[src]
Arithmetically right-shifts this APInt
by the amount represented by other
.
Errors
- When
self
andother
have different bit-widths.
Trait Implementations
impl Drop for APInt
[src]
impl Clone for APInt
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for APInt
[src]
impl<'a> BitAnd<&'a APInt> for APInt
[src]
type Output = APInt
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the &
operation.
impl<'a> BitOr<&'a APInt> for APInt
[src]
type Output = APInt
The resulting type after applying the |
operator.
fn bitor(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the |
operation.
impl<'a> BitXor<&'a APInt> for APInt
[src]
type Output = APInt
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the ^
operation.
impl<'a, 'b> BitAnd<&'a APInt> for &'b APInt
[src]
type Output = APInt
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the &
operation.
impl<'a, 'b> BitOr<&'a APInt> for &'b APInt
[src]
type Output = APInt
The resulting type after applying the |
operator.
fn bitor(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the |
operation.
impl<'a, 'b> BitXor<&'a APInt> for &'b APInt
[src]
type Output = APInt
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the ^
operation.
impl<'a> BitAndAssign<&'a APInt> for APInt
[src]
fn bitand_assign(&mut self, rhs: &'a APInt)
[src]
Performs the &=
operation.
impl<'a> BitOrAssign<&'a APInt> for APInt
[src]
fn bitor_assign(&mut self, rhs: &'a APInt)
[src]
Performs the |=
operation.
impl<'a> BitXorAssign<&'a APInt> for APInt
[src]
fn bitxor_assign(&mut self, rhs: &'a APInt)
[src]
Performs the ^=
operation.
impl PartialEq for APInt
[src]
fn eq(&self, other: &APInt) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for APInt
[src]
impl Neg for APInt
[src]
type Output = APInt
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
Performs the unary -
operation.
impl<'a> Add<&'a APInt> for APInt
[src]
type Output = APInt
The resulting type after applying the +
operator.
fn add(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the +
operation.
impl<'a, 'b> Add<&'a APInt> for &'b APInt
[src]
type Output = APInt
The resulting type after applying the +
operator.
fn add(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the +
operation.
impl<'a> AddAssign<&'a APInt> for APInt
[src]
fn add_assign(&mut self, rhs: &'a APInt)
[src]
Performs the +=
operation.
impl<'a> Mul<&'a APInt> for APInt
[src]
type Output = APInt
The resulting type after applying the *
operator.
fn mul(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the *
operation.
impl<'a, 'b> Mul<&'a APInt> for &'b APInt
[src]
type Output = APInt
The resulting type after applying the *
operator.
fn mul(self, rhs: &'a APInt) -> Self::Output
[src]
Performs the *
operation.
impl<'a> MulAssign<&'a APInt> for APInt
[src]
fn mul_assign(&mut self, rhs: &'a APInt)
[src]
Performs the *=
operation.