Unsigned18Bit

Struct Unsigned18Bit 

Source
pub struct Unsigned18Bit {
    pub(crate) bits: u32,
}
Expand description

Unsigned18Bit is the value of a “half” of the 36-bit TX-2 machine word. We use this type to hold STUV-memory addresses, among other things. Physical memory addresses though are only 17 bits wide. The remaining bit can be used to “mark” an address either for tracing (when it’s an instruction address) or for deferred addressing (when it’s an operand address).

Fields§

§bits: u32

Implementations§

Source§

impl Unsigned18Bit

Source

const MODULUS: u32 = 262_144u32

Source

const VALUE_BITS: u32 = 262_143u32

Source

pub const MAX: Self

Source

pub const ZERO: Self

Source

pub const ONE: Self

Source

pub const MIN: Self = Self::ZERO

Source

pub const fn new<const N: u32>() -> Unsigned18Bit

Source

pub const fn is_zero(&self) -> bool

Source

pub const fn is_negative(&self) -> bool

Source

pub const fn is_positive(&self) -> bool

Source

pub const fn reinterpret_as_signed(&self) -> Signed18Bit

Source

pub fn wrapping_add(self, rhs: Unsigned18Bit) -> Unsigned18Bit

Source

pub fn wrapping_sub(self, rhs: Unsigned18Bit) -> Unsigned18Bit

Source

pub fn checked_add(self, rhs: Unsigned18Bit) -> Option<Unsigned18Bit>

Source

pub fn checked_sub(self, rhs: Unsigned18Bit) -> Option<Unsigned18Bit>

Source

pub fn wrapping_mul(self, rhs: Unsigned18Bit) -> Unsigned18Bit

Source

pub fn checked_mul(self, rhs: Unsigned18Bit) -> Option<Unsigned18Bit>

Source

pub fn checked_div(self, rhs: Unsigned18Bit) -> Option<Unsigned18Bit>

Source

pub const fn abs(self) -> Self

Source

pub const fn overflowing_abs(self) -> (Self, bool)

Source

pub const fn and(self, mask: u32) -> Self

Source

pub const fn bitor(self, mask: u32) -> Self

Trait Implementations§

Source§

impl BitAnd<Unsigned18Bit> for Unsigned36Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Unsigned18Bit) -> Unsigned18Bit

Performs the & operation. Read more
Source§

impl BitAnd<u32> for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the & operator.
Source§

fn bitand(self, mask: u32) -> Self

Performs the & operation. Read more
Source§

impl BitAnd for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
Source§

impl BitOr<u32> for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the | operator.
Source§

fn bitor(self, mask: u32) -> Self

Performs the | operation. Read more
Source§

impl BitOr for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
Source§

impl BitXor<u32> for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, mask: u32) -> Self

Performs the ^ operation. Read more
Source§

impl BitXor for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self

Performs the ^ operation. Read more
Source§

impl Clone for Unsigned18Bit

Source§

fn clone(&self) -> Unsigned18Bit

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Unsigned18Bit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Unsigned18Bit

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Unsigned18Bit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<&Address> for Unsigned18Bit

Source§

fn from(addr: &Address) -> Self

Converts to this type from the input type.
Source§

impl From<Address> for Unsigned18Bit

Source§

fn from(addr: Address) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for Address

Source§

fn from(a: Unsigned18Bit) -> Address

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for Unsigned36Bit

Source§

fn from(n: Unsigned18Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for i32

Source§

fn from(n: Unsigned18Bit) -> i32

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for i64

Source§

fn from(n: Unsigned18Bit) -> i64

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for isize

Source§

fn from(n: Unsigned18Bit) -> isize

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for u32

Source§

fn from(n: Unsigned18Bit) -> u32

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for u64

Source§

fn from(n: Unsigned18Bit) -> u64

Converts to this type from the input type.
Source§

impl From<Unsigned18Bit> for usize

Source§

fn from(n: Unsigned18Bit) -> usize

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for Unsigned18Bit

Source§

fn from(n: Unsigned5Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned9Bit> for Unsigned18Bit

Source§

fn from(n: Unsigned9Bit) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Unsigned18Bit

Source§

fn from(n: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Unsigned18Bit

Source§

fn from(n: u8) -> Self

Converts to this type from the input type.
Source§

impl Hash for Unsigned18Bit

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IndexBy<Unsigned18Bit> for Address

Source§

impl Not for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self

Performs the unary ! operation. Read more
Source§

impl Octal for Unsigned18Bit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Ord for Unsigned18Bit

Source§

fn cmp(&self, other: &Unsigned18Bit) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq<T> for Unsigned18Bit

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<u32> for Unsigned18Bit

Source§

fn partial_cmp(&self, other: &u32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u64> for Unsigned18Bit

Source§

fn partial_cmp(&self, other: &u64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for Unsigned18Bit

Source§

fn partial_cmp(&self, other: &Unsigned18Bit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Unsigned18Bit

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Shl<u32> for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self

Performs the << operation. Read more
Source§

impl Shl for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the << operator.
Source§

fn shl(self, shift_by: Unsigned18Bit) -> Self

Performs the << operation. Read more
Source§

impl Shr<u32> for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the >> operator.
Source§

fn shr(self, shift_by: u32) -> Self

Performs the >> operation. Read more
Source§

impl Shr for Unsigned18Bit

Source§

type Output = Unsigned18Bit

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: Self) -> Self

Performs the >> operation. Read more
Source§

impl Sum for Unsigned18Bit

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl TryFrom<Unsigned18Bit> for Signed18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned18Bit> for Unsigned12Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned18Bit> for Unsigned6Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned18Bit> for i16

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<i16, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned18Bit> for i8

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<i8, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned18Bit> for u16

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<u16, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned18Bit> for u8

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned18Bit) -> Result<u8, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<Unsigned36Bit> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: Unsigned36Bit) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i16> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: i16) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i32> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: i32) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i64> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: i64) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i8> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: i8) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<u32> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: u32) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<u64> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: u64) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<usize> for Unsigned18Bit

Source§

type Error = ConversionFailed

The type returned in the event of a conversion error.
Source§

fn try_from(n: usize) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl WordCommon for Unsigned18Bit

Source§

fn signum(&self) -> Signum

Source§

impl Copy for Unsigned18Bit

Source§

impl Eq for Unsigned18Bit

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.