Expand description
A generic, very low-level structure for data and code storage. It has no concept of numbers or strings. Instead, it manipulates an array of bits. The basic operations can be used to store numbers or strings, compose methods like addition, multiplication, etc. This makes the module really versatile.
Fields
data: Vec<bool>
Implementations
sourceimpl Memory
impl Memory
sourcepub fn load(&mut self, vec: &mut Vec<bool>)
pub fn load(&mut self, vec: &mut Vec<bool>)
Load a memory snapshot and drop the content from before
sourcepub fn shrink(&mut self, amount: usize) -> Result<(), &'static str>
pub fn shrink(&mut self, amount: usize) -> Result<(), &'static str>
Shrink the container by (n) bits
sourcepub fn single_and(
&mut self,
a: Address,
b: Address,
out: Address
) -> Result<(), &'static str>
pub fn single_and(
&mut self,
a: Address,
b: Address,
out: Address
) -> Result<(), &'static str>
Perform a bitwise AND operation on a single bit
sourcepub fn single_or(
&mut self,
a: Address,
b: Address,
out: Address
) -> Result<(), &'static str>
pub fn single_or(
&mut self,
a: Address,
b: Address,
out: Address
) -> Result<(), &'static str>
Perform a bitwise OR operation on a single bit
sourcepub fn single_xor(
&mut self,
a: Address,
b: Address,
out: Address
) -> Result<(), &'static str>
pub fn single_xor(
&mut self,
a: Address,
b: Address,
out: Address
) -> Result<(), &'static str>
Perform a bitwise exclusive OR operation on a single bit
sourcepub fn single_not(&mut self, a: Address, out: Address) -> Result<(), &'static str>
pub fn single_not(&mut self, a: Address, out: Address) -> Result<(), &'static str>
Perform a bitwise negation on a single bit
sourcepub fn range_and(
&mut self,
a: Range,
b: Range,
out: Range
) -> Result<(), &'static str>
pub fn range_and(
&mut self,
a: Range,
b: Range,
out: Range
) -> Result<(), &'static str>
Perform a bitwise AND operation on a range of bits
sourcepub fn range_or(
&mut self,
a: Range,
b: Range,
out: Range
) -> Result<(), &'static str>
pub fn range_or(
&mut self,
a: Range,
b: Range,
out: Range
) -> Result<(), &'static str>
Perform a bitwise OR operation on a range of bits
sourcepub fn range_xor(
&mut self,
a: Range,
b: Range,
out: Range
) -> Result<(), &'static str>
pub fn range_xor(
&mut self,
a: Range,
b: Range,
out: Range
) -> Result<(), &'static str>
Perform a bitwise exclusive OR operation on a range of bits
pub fn range_not(&mut self, a: Range, out: Range) -> Result<(), &'static str>
pub fn lshift(
&mut self,
by: usize,
a: Range,
out: Range
) -> Result<(), &'static str>
sourcepub fn rshift(&mut self, by: usize, a: Range, out: Range)
pub fn rshift(&mut self, by: usize, a: Range, out: Range)
Perform an arithmetic (sign-preserving) right-shift on a range of bits and write the result to another range