pub trait Signs: BitSize {
fn sign_bit(&self) -> bool;
fn sign_extend(&self, bits: usize) -> Self;
}
Expand description
Provides operations based on signs
This trait defines functions for querying the sign bit of values and for sign extending values from arbitrary values.
Examples
use quark::Signs;
let value: u32 = 0xffff_fff0;
assert_eq!(value.sign_bit(), true);
let value: u32 = 0x0000_8000;
assert_eq!(value.sign_extend(16), 0xffff_8000);
Required Methods
sourcefn sign_extend(&self, bits: usize) -> Self
fn sign_extend(&self, bits: usize) -> Self
Fills the upper N bits of a value with the next bit down.