struct SignedBoxedInt {
sign: Choice,
magnitude: BoxedUint,
}Expand description
A Uint which carries a separate sign in order to maintain the same range.
Fields§
§sign: Choice§magnitude: BoxedUintImplementations§
Source§impl SignedBoxedInt
impl SignedBoxedInt
pub fn zero_with_precision(bits_precision: u32) -> Self
Sourcepub fn from_uint_with_precision(uint: &BoxedUint, bits_precision: u32) -> Self
pub fn from_uint_with_precision(uint: &BoxedUint, bits_precision: u32) -> Self
Construct a new SignedInt from a Uint.
Sourcepub const fn from_uint_sign(magnitude: BoxedUint, sign: Choice) -> Self
pub const fn from_uint_sign(magnitude: BoxedUint, sign: Choice) -> Self
Construct a new SignedInt from a Uint and a sign flag.
Sourcepub const fn magnitude(&self) -> &BoxedUint
pub const fn magnitude(&self) -> &BoxedUint
Obtain the magnitude of the SignedInt, i.e. its absolute value.
Sourcepub fn is_nonzero(&self) -> Choice
pub fn is_nonzero(&self) -> Choice
Determine if the SignedInt is non-zero.
Sourcepub fn is_zero_vartime(&self) -> bool
pub fn is_zero_vartime(&self) -> bool
Determine if the SignedInt is zero in variable time.
Sourcepub const fn is_negative(&self) -> Choice
pub const fn is_negative(&self) -> Choice
Determine if the SignedInt is negative.
Note: -0 is representable in this type, so it may be necessary
to check self.is_nonzero() as well.
Sourcepub fn lowest(&self) -> i64
pub fn lowest(&self) -> i64
Extract the lowest 63 bits and convert to its signed representation.
Sourcepub(crate) fn lincomb_int<const RHS: usize>(
a: &Self,
b: &Self,
c: &Int<RHS>,
d: &Int<RHS>,
) -> Self
pub(crate) fn lincomb_int<const RHS: usize>( a: &Self, b: &Self, c: &Int<RHS>, d: &Int<RHS>, ) -> Self
Compute the linear combination a•b + c•d, returning a widened result.
Sourcepub(crate) fn lincomb_int_reduce_shift<const S: usize>(
a: &Self,
b: &Self,
c: &Int<S>,
d: &Int<S>,
shift: u32,
) -> Self
pub(crate) fn lincomb_int_reduce_shift<const S: usize>( a: &Self, b: &Self, c: &Int<S>, d: &Int<S>, shift: u32, ) -> Self
Compute the linear combination a•b + c•d, and shift the result
shift bits to the right, returning a signed value in the same range
as the SignedInt inputs.
Sourcepub(crate) fn lincomb_int_reduce_shift_mod<const S: usize>(
a: &Self,
b: &Self,
c: &Int<S>,
d: &Int<S>,
shift: u32,
m: &BoxedUint,
mi: Uint<S>,
) -> Self
pub(crate) fn lincomb_int_reduce_shift_mod<const S: usize>( a: &Self, b: &Self, c: &Int<S>, d: &Int<S>, shift: u32, m: &BoxedUint, mi: Uint<S>, ) -> Self
Compute the linear combination a•b + c•d, and shift the result
shift bits to the right modulo m, returning a signed value in the
same range as the SignedInt inputs.
Trait Implementations§
Source§impl Clone for SignedBoxedInt
impl Clone for SignedBoxedInt
Source§fn clone(&self) -> SignedBoxedInt
fn clone(&self) -> SignedBoxedInt
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more