From 5697c17af9ba0854f37edc5970ec862c446002d2 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 9 Feb 2019 03:55:01 -0800 Subject: some more inlining hints that appear to help cargo bench do things good (this nets another 15% runtime improvement) --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index dd2941d..5a5f34d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,6 +13,7 @@ pub struct RegSpec { } impl RegSpec { + #[inline] fn from_parts(num: u8, extended: bool, bank: RegisterBank) -> RegSpec { RegSpec { num: num + if extended { 0b1000 } else { 0 }, @@ -20,6 +21,7 @@ impl RegSpec { } } + #[inline] fn gp_from_parts(num: u8, extended: bool, width: u8, rex: bool) -> RegSpec { // println!("from_parts width: {}, num: {}, extended: {}", width, num, extended); RegSpec { @@ -28,6 +30,7 @@ impl RegSpec { } } + #[inline] fn RIP() -> RegSpec { RegSpec { num: 0, @@ -35,6 +38,7 @@ impl RegSpec { } } + #[inline] fn EIP() -> RegSpec { RegSpec { num: 0, @@ -1451,6 +1455,7 @@ fn read_E<'a, T: Iterator>(bytes_iter: &mut T, prefixes: &Prefixes, Ok(()) } +#[inline] fn read_operands<'a, T: Iterator>( bytes_iter: &mut T, instruction: &mut Instruction, @@ -1979,6 +1984,7 @@ fn read_operands<'a, T: Iterator>( } } +#[inline] fn width_to_gp_reg_bank(width: u8, rex: bool) -> RegisterBank { use std::hint::unreachable_unchecked; match width { @@ -2015,6 +2021,7 @@ pub fn decode_one<'a, 'b, T: IntoIterator>(bytes: T, instr: &'b mut } } +#[inline] fn read_num<'a, T: Iterator>(bytes: &mut T, width: u8) -> u64 { let mut result = 0u64; let mut idx = 0; -- cgit v1.1