tangled
alpha
login
or
join now
tjh.dev
/
um32
1
fork
atom
Implementation of the UM-32 "Universal Machine" as described by the
Cult of the Bound Variable
1
fork
atom
overview
issues
pulls
pipelines
clippy
tjh
1 year ago
09711c44
d6c268a4
+2
-2
2 changed files
expand all
collapse all
unified
split
src
asm.rs
lib.rs
+1
-1
src/asm.rs
···
184
184
fn encode_literal(value: u32) -> u32 {
185
185
const LITERAL_MAX: u32 = 0x1ffffff;
186
186
assert!(value <= LITERAL_MAX, "literal value exceeds available bits. value: {value} (0x{value:x}), max: {LITERAL_MAX} (0x{LITERAL_MAX:x})");
187
187
-
value as u32
187
187
+
value
188
188
}
189
189
190
190
fn encode_standard(op: u32, a: &Register, b: &Register, c: &Register) -> u32 {
+1
-1
src/lib.rs
···
549
549
fn allocate_memory(&mut self, length: u32) -> u32 {
550
550
if let Some(index) = self.free_blocks.pop() {
551
551
self.memory[index.into_index()] = Self::new_block(length.into_index());
552
552
-
index as u32
552
552
+
index
553
553
} else {
554
554
self.memory.push(Self::new_block(length.into_index()));
555
555
(self.memory.len() - 1) as u32