forked from n3tael/labast
14 lines
328 B
Rust
14 lines
328 B
Rust
use crate::errors::RunError;
|
|
|
|
pub fn nand(memory: &mut Vec<u16>) {
|
|
let a: bool = memory.pop().expect(&format!("{}", RunError::MemoryEmpty)) == 1;
|
|
let b: bool = memory.pop().expect(&format!("{}", RunError::MemoryEmpty)) == 1;
|
|
|
|
let c: u16 = if !(a && b) {
|
|
1
|
|
} else {
|
|
0
|
|
};
|
|
|
|
memory.push(c);
|
|
} |