Last active
October 10, 2016 07:11
-
-
Save duckinator/7400477dc8262532feab20f819a19b94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut methods = std::collections::HashMap::new(); | |
methods.insert(0b0000, mov); | |
methods.insert(0b0001, add); | |
methods.insert(0b0010, nand); | |
// ... | |
fn execute(opcode: u8, operand1: u8, operand2: u8) { | |
methods.get(opcode)(operand1, operand2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment