diff options
| author | taitep <taitep@taitep.se> | 2025-10-07 20:23:59 +0200 |
|---|---|---|
| committer | taitep <taitep@taitep.se> | 2025-10-07 20:23:59 +0200 |
| commit | ee5f5a2ec41ed426440346ff47339b63c2cf7c1d (patch) | |
| tree | edc61c079f6a0070ddee7813966ad30a04ee23da /src/instructions/gen_tools.rs | |
| parent | 361b36fbd1ba4a710abbc866da1c641545a6d53f (diff) | |
FIRST INSTRUCTION WORKING
Diffstat (limited to 'src/instructions/gen_tools.rs')
| -rw-r--r-- | src/instructions/gen_tools.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/instructions/gen_tools.rs b/src/instructions/gen_tools.rs new file mode 100644 index 0000000..ad9ad62 --- /dev/null +++ b/src/instructions/gen_tools.rs @@ -0,0 +1,22 @@ +use std::hint::unreachable_unchecked; + +use crate::instructions::{OpcodeHandler, Splitter}; + +pub fn insert_funct3_splitter(splitter: &mut Option<Splitter>) -> &mut [OpcodeHandler; 8] { + match splitter { + Some(Splitter::Funct3Splitter(s)) => s.as_mut(), + Some(_) => panic!("Unexpected splitter variant"), + None => { + *splitter = Some(Splitter::Funct3Splitter(Box::new(std::array::from_fn( + |_i| OpcodeHandler { + handler: None, + splitter: None, + }, + )))); + match splitter { + Some(Splitter::Funct3Splitter(s)) => s.as_mut(), + _ => unsafe { unreachable_unchecked() }, + } + } + } +} |
