Skip to content

Commit

Permalink
Add note.
Browse files Browse the repository at this point in the history
  • Loading branch information
thealmarty committed Apr 17, 2024
1 parent 7724941 commit c134477
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion machine/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn index_of_byte(addr: u32) -> usize {
(addr & 3) as usize
}

/// Get the address to the map of the memory cells which is not empty (a multiple of 4).
/// Get the address of the memory cells which is not empty (a multiple of 4).
pub fn index_to_word(addr: u32) -> u32 {
(addr & !3) as u32
}
Expand All @@ -28,6 +28,7 @@ impl Word<u8> {
}

impl Word<u8> {
//TODO if the byte isn't the lowest byte then this doesn't make sense?
pub fn sign_extend_byte(byte: u8, loc: usize) -> Self {
let sign = byte as i8 >> 7;
let mut result: [u8; MEMORY_CELL_BYTES] = [sign as u8; MEMORY_CELL_BYTES];
Expand Down

0 comments on commit c134477

Please sign in to comment.