Skip to content

Commit

Permalink
Remove zero_extend_byte and update sign_extend_byte.
Browse files Browse the repository at this point in the history
  • Loading branch information
thealmarty committed Apr 22, 2024
1 parent 5fc8ad0 commit 2ffbe9d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions machine/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ impl Word<u8> {
pub fn sign_extend_byte(byte: u8) -> Self {
let sign = byte as i8 >> 7;
let mut result: [u8; MEMORY_CELL_BYTES] = [sign as u8; MEMORY_CELL_BYTES];
result[0] = byte;
Self(result)
}
}

impl Word<u8> {
pub fn zero_extend_byte(byte: u8) -> Self {
let mut result: [u8; MEMORY_CELL_BYTES] = [0; MEMORY_CELL_BYTES];
result[0] = byte;
result[3] = byte;
Self(result)
}
}
Expand Down

0 comments on commit 2ffbe9d

Please sign in to comment.