Skip to content

Commit

Permalink
Keep a ref to vex map0 even if mvex feature is disabled
Browse files Browse the repository at this point in the history
Closes #524
  • Loading branch information
wtfsck committed Feb 24, 2024
1 parent 7d6a3f5 commit dd3e47e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/rust/iced-x86/src/decoder/handlers/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(in crate::decoder) struct Tables {
invalid_map: (),

pub(in crate::decoder) handlers_map0: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(all(not(feature = "no_vex"), feature = "mvex"))]
#[cfg(not(feature = "no_vex"))]
pub(in crate::decoder) handlers_vex_map0: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(not(feature = "no_vex"))]
pub(in crate::decoder) handlers_vex_0f: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Expand Down Expand Up @@ -44,7 +44,7 @@ pub(in crate::decoder) struct Tables {
pub(in crate::decoder) handlers_mvex_0f38: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(feature = "mvex")]
pub(in crate::decoder) handlers_mvex_0f3a: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(not(all(not(feature = "no_vex"), feature = "mvex")))]
#[cfg(feature = "no_vex")]
#[allow(dead_code)]
handlers_vex_map0: (),
#[cfg(feature = "no_vex")]
Expand Down
14 changes: 2 additions & 12 deletions src/rust/iced-x86/src/decoder/table_de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,11 @@ pub(super) fn read_evex() -> (
)
}

#[cfg(all(not(feature = "no_vex"), feature = "mvex"))]
type VexMap0Type = Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>;
#[cfg(all(not(feature = "no_vex"), not(feature = "mvex")))]
type VexMap0Type = ();

#[cfg(not(feature = "no_vex"))]
#[must_use]
#[allow(clippy::let_unit_value)]
pub(super) fn read_vex() -> (
VexMap0Type,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Expand All @@ -327,13 +322,8 @@ pub(super) fn read_vex() -> (
let mut deserializer = TableDeserializer::new(data_vex::TBL_DATA, data_vex::MAX_ID_NAMES, handler_reader);
deserializer.deserialize();

#[cfg(feature = "mvex")]
let map0 = deserializer.table(data_vex::HANDLERS_MAP0_INDEX);
#[cfg(not(feature = "mvex"))]
let map0 = ();

(
map0,
deserializer.table(data_vex::HANDLERS_MAP0_INDEX),
deserializer.table(data_vex::HANDLERS_0F_INDEX),
deserializer.table(data_vex::HANDLERS_0F38_INDEX),
deserializer.table(data_vex::HANDLERS_0F3A_INDEX),
Expand Down

0 comments on commit dd3e47e

Please sign in to comment.