[−][src]Struct iota_ternary_preview::bigint::i384::I384
A biginteger encoding a signed integer with 384 bits.
T
is usually taken as a [u32; 12]
or [u8; 48]
.
E
refers to the endianness of the digits in T
. This means that in the case of [u32; 12]
,
if E == BigEndian
, that the u32 at position i=0 is considered the most significant digit. The
endianness E
here makes no statement about the endianness of each single digit within itself
(this then is dependent on the endianness of the platform this code is run on).
For E == LittleEndian
the digit at the last position is considered to be the most
significant.
Methods
impl<E, T> I384<E, T>
[src]
impl I384<BigEndian, U8Repr>
[src]
pub const fn from_array(inner: U8Repr) -> Self
[src]
impl I384<BigEndian, U32Repr>
[src]
pub const fn from_array(inner: U32Repr) -> Self
[src]
impl I384<LittleEndian, U8Repr>
[src]
pub const fn from_array(inner: U8Repr) -> Self
[src]
impl I384<LittleEndian, U32Repr>
[src]
pub const fn from_array(inner: U32Repr) -> Self
[src]
impl I384<BigEndian, U8Repr>
[src]
pub const fn zero() -> Self
[src]
pub const fn one() -> Self
[src]
pub const fn neg_one() -> Self
[src]
pub const fn two() -> Self
[src]
pub const fn neg_two() -> Self
[src]
pub const fn max() -> Self
[src]
pub const fn min() -> Self
[src]
impl I384<LittleEndian, U8Repr>
[src]
pub const fn zero() -> Self
[src]
pub const fn one() -> Self
[src]
pub const fn neg_one() -> Self
[src]
pub const fn two() -> Self
[src]
pub const fn neg_two() -> Self
[src]
pub const fn max() -> Self
[src]
pub const fn min() -> Self
[src]
impl I384<BigEndian, U32Repr>
[src]
pub const fn zero() -> Self
[src]
pub const fn one() -> Self
[src]
pub const fn neg_one() -> Self
[src]
pub const fn two() -> Self
[src]
pub const fn neg_two() -> Self
[src]
pub const fn max() -> Self
[src]
pub const fn min() -> Self
[src]
impl I384<LittleEndian, U32Repr>
[src]
pub const fn zero() -> Self
[src]
pub const fn one() -> Self
[src]
pub const fn neg_one() -> Self
[src]
pub const fn two() -> Self
[src]
pub const fn neg_two() -> Self
[src]
pub const fn max() -> Self
[src]
pub const fn min() -> Self
[src]
impl I384<BigEndian, U8Repr>
[src]
pub fn not_inplace(&mut self)
[src]
impl I384<BigEndian, U32Repr>
[src]
pub fn add_inplace(&mut self, other: Self)
[src]
Adds other
onto self
in place.
pub fn add_digit_inplace<T: Into<u32>>(&mut self, other: T) -> usize
[src]
Adds other
in place, returning the number of digits required accomodate other
(starting
from the least significant one).
pub fn as_u384(self) -> U384<BigEndian, U32Repr>
[src]
pub fn from_t242(value: T242<Btrit>) -> Self
[src]
pub fn is_positive(&self) -> bool
[src]
pub fn is_negative(&self) -> bool
[src]
pub fn not_inplace(&mut self)
[src]
Applies logical not to all elements in a &[u32]
, modfiying them in place.
Examples
let xs: I384<LittleEndian, _> = I384::from_array([0xffff_ffffu32; LEN_IN_U32]); let mut ys = I384::from_array([0x0000_0000u32; LEN_IN_U32]); ys.not_inplace(); assert_eq!(xs, ys);
pub fn shift_into_u384(self) -> U384<BigEndian, U32Repr>
[src]
pub fn sub_inplace(&mut self, other: Self)
[src]
Subtract other
from self
inplace.
This function is defined in terms of overflowing_add
by making use of the following identity
(in terms of Two's complement, and where !
is logical bitwise negation):
!x = -x -1 => -x = !x + 1
TODO: Verifiy that the final assert is indeed not necessary. Preliminary testing shows that results are as expected.
pub fn sub_integer_inplace<T: Into<u32>>(&mut self, other: T) -> usize
[src]
Subtracts other
in place, returning the number of digits required accomodate other
(starting from the least significant one).
pub fn try_from_t243(balanced_trits: T243<Btrit>) -> Result<Self, Error>
[src]
impl I384<LittleEndian, U32Repr>
[src]
pub fn add_inplace(&mut self, other: Self)
[src]
Adds other
onto self
in place.
pub fn add_digit_inplace<T: Into<u32>>(&mut self, other: T) -> usize
[src]
Adds other
in place, returning the number of digits required accomodate other
(starting
from the least significant one).
pub fn as_u384(self) -> U384<LittleEndian, U32Repr>
[src]
pub fn from_t242(value: T242<Btrit>) -> Self
[src]
pub fn is_positive(&self) -> bool
[src]
pub fn is_negative(&self) -> bool
[src]
pub fn not_inplace(&mut self)
[src]
Applies logical not to all elements in a &[u32]
, modfiying them in place.
Examples
let xs: I384<LittleEndian, _> = I384::from_array([0xffff_ffffu32; LEN_IN_U32]); let mut ys = I384::from_array([0x0000_0000u32; LEN_IN_U32]); ys.not_inplace(); assert_eq!(xs, ys);
pub fn shift_into_u384(self) -> U384<LittleEndian, U32Repr>
[src]
pub fn sub_inplace(&mut self, other: Self)
[src]
Subtract other
from self
inplace.
This function is defined in terms of overflowing_add
by making use of the following identity
(in terms of Two's complement, and where !
is logical bitwise negation):
!x = -x -1 => -x = !x + 1
TODO: Verifiy that the final assert is indeed not necessary. Preliminary testing shows that results are as expected.
pub fn sub_integer_inplace<T: Into<u32>>(&mut self, other: T) -> usize
[src]
Subtracts other
in place, returning the number of digits required accomodate other
(starting from the least significant one).
pub fn try_from_t243(balanced_trits: T243<Btrit>) -> Result<Self, Error>
[src]
pub fn zero_most_significant_trit(&mut self)
[src]
Trait Implementations
impl<E: Clone, T: Clone> Clone for I384<E, T>
[src]
impl<E: Copy, T: Copy> Copy for I384<E, T>
[src]
impl<E: Debug, R: BinaryRepresentation, D> Debug for I384<E, R> where
E: Debug,
R: BinaryRepresentation<T = D>,
D: Debug,
[src]
E: Debug,
R: BinaryRepresentation<T = D>,
D: Debug,
impl Default for I384<BigEndian, U8Repr>
[src]
impl Default for I384<BigEndian, U32Repr>
[src]
impl Default for I384<LittleEndian, U8Repr>
[src]
impl Default for I384<LittleEndian, U32Repr>
[src]
impl Eq for I384<BigEndian, U8Repr>
[src]
impl Eq for I384<BigEndian, U32Repr>
[src]
impl Eq for I384<LittleEndian, U8Repr>
[src]
impl Eq for I384<LittleEndian, U32Repr>
[src]
impl From<I384<BigEndian, [u32; 12]>> for I384<BigEndian, U8Repr>
[src]
impl From<I384<BigEndian, [u32; 12]>> for I384<LittleEndian, U32Repr>
[src]
impl From<I384<BigEndian, [u32; 12]>> for T243<Btrit>
[src]
impl From<I384<BigEndian, [u8; 48]>> for I384<BigEndian, U32Repr>
[src]
impl From<I384<BigEndian, [u8; 48]>> for I384<LittleEndian, U8Repr>
[src]
impl From<I384<BigEndian, [u8; 48]>> for T243<Btrit>
[src]
impl From<I384<LittleEndian, [u32; 12]>> for I384<LittleEndian, U8Repr>
[src]
fn from(value: I384<LittleEndian, U32Repr>) -> Self
[src]
impl From<I384<LittleEndian, [u32; 12]>> for I384<BigEndian, U32Repr>
[src]
fn from(value: I384<LittleEndian, U32Repr>) -> Self
[src]
impl From<I384<LittleEndian, [u32; 12]>> for T243<Btrit>
[src]
fn from(value: I384<LittleEndian, U32Repr>) -> Self
[src]
impl From<I384<LittleEndian, [u8; 48]>> for I384<LittleEndian, U32Repr>
[src]
fn from(value: I384<LittleEndian, U8Repr>) -> Self
[src]
impl From<I384<LittleEndian, [u8; 48]>> for I384<BigEndian, U8Repr>
[src]
fn from(value: I384<LittleEndian, U8Repr>) -> Self
[src]
impl From<T242<Btrit>> for I384<BigEndian, U8Repr>
[src]
impl From<T242<Btrit>> for I384<BigEndian, U32Repr>
[src]
impl From<T242<Btrit>> for I384<LittleEndian, U32Repr>
[src]
impl Ord for I384<BigEndian, U8Repr>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl Ord for I384<BigEndian, U32Repr>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl Ord for I384<LittleEndian, U8Repr>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl Ord for I384<LittleEndian, U32Repr>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<I384<BigEndian, [u32; 12]>> for I384<BigEndian, U32Repr>
[src]
impl PartialEq<I384<BigEndian, [u8; 48]>> for I384<BigEndian, U8Repr>
[src]
impl PartialEq<I384<LittleEndian, [u32; 12]>> for I384<LittleEndian, U32Repr>
[src]
impl PartialEq<I384<LittleEndian, [u8; 48]>> for I384<LittleEndian, U8Repr>
[src]
impl PartialOrd<I384<BigEndian, [u32; 12]>> for I384<BigEndian, U32Repr>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<I384<BigEndian, [u8; 48]>> for I384<BigEndian, U8Repr>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<I384<LittleEndian, [u32; 12]>> for I384<LittleEndian, U32Repr>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<I384<LittleEndian, [u8; 48]>> for I384<LittleEndian, U8Repr>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl TryFrom<I384<BigEndian, [u32; 12]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<BigEndian, U32Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<I384<BigEndian, [u8; 48]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<BigEndian, U8Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<I384<LittleEndian, [u32; 12]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<LittleEndian, U32Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<I384<LittleEndian, [u8; 48]>> for T242<Btrit>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: I384<LittleEndian, U8Repr>) -> Result<Self, Self::Error>
[src]
impl TryFrom<T243<Btrit>> for I384<BigEndian, U8Repr>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: T243<Btrit>) -> Result<Self, Error>
[src]
impl TryFrom<T243<Btrit>> for I384<BigEndian, U32Repr>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: T243<Btrit>) -> Result<Self, Error>
[src]
impl TryFrom<T243<Btrit>> for I384<LittleEndian, U32Repr>
[src]
Auto Trait Implementations
impl<E, T> RefUnwindSafe for I384<E, T> where
E: RefUnwindSafe,
T: RefUnwindSafe,
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<E, T> Send for I384<E, T> where
E: Send,
T: Send,
E: Send,
T: Send,
impl<E, T> Sync for I384<E, T> where
E: Sync,
T: Sync,
E: Sync,
T: Sync,
impl<E, T> Unpin for I384<E, T> where
E: Unpin,
T: Unpin,
E: Unpin,
T: Unpin,
impl<E, T> UnwindSafe for I384<E, T> where
E: UnwindSafe,
T: UnwindSafe,
E: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,