pub struct Signed18Bit {
pub(crate) bits: u32,
}
Expand description
Signed counterpart of Unsigned18Bit
.
Fields§
§bits: u32
Implementations§
Source§impl Signed18Bit
impl Signed18Bit
const SIGN_BIT: u32 = 131_072u32
const VALUE_BITS: u32 = 131_071u32
const ALL_BITS: u32 = 262_143u32
pub const MAX: Self
pub const MIN: Self
pub const ZERO: Self
pub const MINUS_ZERO: Self
pub const ONE: Self
pub const fn is_positive_zero(&self) -> bool
pub const fn is_negative_zero(&self) -> bool
pub const fn is_zero(&self) -> bool
pub const fn reinterpret_as_unsigned(&self) -> Unsigned18Bit
pub const fn is_negative(&self) -> bool
pub const fn is_positive(&self) -> bool
pub const fn convert_to_ones_complement(signed: i32) -> u32
pub fn checked_add(self, rhs: Signed18Bit) -> Option<Signed18Bit>
pub fn checked_sub(self, rhs: Signed18Bit) -> Option<Signed18Bit>
pub fn wrapping_add(self, rhs: Signed18Bit) -> Signed18Bit
pub fn wrapping_sub(self, rhs: Signed18Bit) -> Signed18Bit
pub fn checked_div(self, rhs: Signed18Bit) -> Option<Signed18Bit>
pub const fn abs(self) -> Self
pub const fn overflowing_abs(self) -> (Self, bool)
Trait Implementations§
Source§impl Clone for Signed18Bit
impl Clone for Signed18Bit
Source§fn clone(&self) -> Signed18Bit
fn clone(&self) -> Signed18Bit
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Signed18Bit
impl Debug for Signed18Bit
Source§impl Default for Signed18Bit
impl Default for Signed18Bit
Source§impl From<Signed18Bit> for i32
impl From<Signed18Bit> for i32
Source§fn from(n: Signed18Bit) -> i32
fn from(n: Signed18Bit) -> i32
Converts to this type from the input type.
Source§impl From<Signed18Bit> for i64
impl From<Signed18Bit> for i64
Source§fn from(n: Signed18Bit) -> i64
fn from(n: Signed18Bit) -> i64
Converts to this type from the input type.
Source§impl From<Signed18Bit> for isize
impl From<Signed18Bit> for isize
Source§fn from(n: Signed18Bit) -> isize
fn from(n: Signed18Bit) -> isize
Converts to this type from the input type.
Source§impl From<Signed5Bit> for Signed18Bit
impl From<Signed5Bit> for Signed18Bit
Source§fn from(n: Signed5Bit) -> Self
fn from(n: Signed5Bit) -> Self
Converts to this type from the input type.
Source§impl From<Signed6Bit> for Signed18Bit
impl From<Signed6Bit> for Signed18Bit
Source§fn from(n: Signed6Bit) -> Self
fn from(n: Signed6Bit) -> Self
Converts to this type from the input type.
Source§impl From<Signed9Bit> for Signed18Bit
impl From<Signed9Bit> for Signed18Bit
Source§fn from(n: Signed9Bit) -> Self
fn from(n: Signed9Bit) -> Self
Converts to this type from the input type.
Source§impl From<i16> for Signed18Bit
impl From<i16> for Signed18Bit
Source§impl From<i8> for Signed18Bit
impl From<i8> for Signed18Bit
Source§impl From<u16> for Signed18Bit
impl From<u16> for Signed18Bit
Source§impl From<u8> for Signed18Bit
impl From<u8> for Signed18Bit
Source§impl Hash for Signed18Bit
impl Hash for Signed18Bit
Source§impl IndexBy<Signed18Bit> for Address
impl IndexBy<Signed18Bit> for Address
fn index_by(&self, delta: Signed18Bit) -> Address
Source§impl Octal for Signed18Bit
impl Octal for Signed18Bit
Source§impl Ord for Signed18Bit
impl Ord for Signed18Bit
Source§fn cmp(&self, other: &Signed18Bit) -> Ordering
fn cmp(&self, other: &Signed18Bit) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq<i32> for Signed18Bit
impl PartialEq<i32> for Signed18Bit
Source§impl PartialEq for Signed18Bit
impl PartialEq for Signed18Bit
Source§impl PartialOrd<i32> for Signed18Bit
impl PartialOrd<i32> for Signed18Bit
Source§impl PartialOrd for Signed18Bit
impl PartialOrd for Signed18Bit
Source§impl TryFrom<Signed18Bit> for i16
impl TryFrom<Signed18Bit> for i16
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<i16, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<i16, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Signed18Bit> for i8
impl TryFrom<Signed18Bit> for i8
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<i8, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<i8, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Signed18Bit> for u16
impl TryFrom<Signed18Bit> for u16
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<u16, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<u16, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Signed18Bit> for u32
impl TryFrom<Signed18Bit> for u32
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<u32, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<u32, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Signed18Bit> for u64
impl TryFrom<Signed18Bit> for u64
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<u64, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<u64, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Signed18Bit> for u8
impl TryFrom<Signed18Bit> for u8
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<u8, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<u8, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Signed18Bit> for usize
impl TryFrom<Signed18Bit> for usize
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Signed18Bit) -> Result<usize, ConversionFailed>
fn try_from(n: Signed18Bit) -> Result<usize, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<Unsigned18Bit> for Signed18Bit
impl TryFrom<Unsigned18Bit> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: Unsigned18Bit) -> Result<Self, ConversionFailed>
fn try_from(n: Unsigned18Bit) -> Result<Self, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<i32> for Signed18Bit
impl TryFrom<i32> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: i32) -> Result<Signed18Bit, ConversionFailed>
fn try_from(n: i32) -> Result<Signed18Bit, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<i64> for Signed18Bit
impl TryFrom<i64> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: i64) -> Result<Signed18Bit, ConversionFailed>
fn try_from(n: i64) -> Result<Signed18Bit, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<isize> for Signed18Bit
impl TryFrom<isize> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: isize) -> Result<Signed18Bit, ConversionFailed>
fn try_from(n: isize) -> Result<Signed18Bit, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<u32> for Signed18Bit
impl TryFrom<u32> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: u32) -> Result<Signed18Bit, ConversionFailed>
fn try_from(n: u32) -> Result<Signed18Bit, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<u64> for Signed18Bit
impl TryFrom<u64> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: u64) -> Result<Signed18Bit, ConversionFailed>
fn try_from(n: u64) -> Result<Signed18Bit, ConversionFailed>
Performs the conversion.
Source§impl TryFrom<usize> for Signed18Bit
impl TryFrom<usize> for Signed18Bit
Source§type Error = ConversionFailed
type Error = ConversionFailed
The type returned in the event of a conversion error.
Source§fn try_from(n: usize) -> Result<Signed18Bit, ConversionFailed>
fn try_from(n: usize) -> Result<Signed18Bit, ConversionFailed>
Performs the conversion.
Source§impl WordCommon for Signed18Bit
impl WordCommon for Signed18Bit
impl Copy for Signed18Bit
impl Eq for Signed18Bit
Auto Trait Implementations§
impl Freeze for Signed18Bit
impl RefUnwindSafe for Signed18Bit
impl Send for Signed18Bit
impl Sync for Signed18Bit
impl Unpin for Signed18Bit
impl UnwindSafe for Signed18Bit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.