From 1dc4e8ab46aa89e42458e0f1bb5ccbc6cb2c4c08 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 8 Nov 2026 09:39:18 -0800 Subject: [PATCH] module_version_1 tests: read a symbol table record's name only for the codes it spells vst_record read the characters of any record before matching its code; a code it does not abbreviate is now written unabbreviated before its operands are read as characters. (cherry picked from commit a507f448ca63b001225486ee648219a9e6f54e32) --- .../metal2vulkan/src/tests/module_version_1.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/metal2vulkan/src/tests/module_version_1.rs b/crates/metal2vulkan/src/tests/module_version_1.rs index bf6932231..00847357d 100644 --- a/crates/metal2vulkan/src/tests/module_version_1.rs +++ b/crates/metal2vulkan/src/tests/module_version_1.rs @@ -395,19 +395,17 @@ fn write_record(w: &mut BitWriter, code: u32, ops: &[u64], blob: Option<&[u8]>) /// [`VST_ABBREVS`] by their characters' width (a basic block's 7-bit name takes the 8-bit one), /// `VST_FNENTRY` through [`FNENTRY_ABBREVS`]. fn vst_record(w: &mut BitWriter, code: u32, ops: &[u64]) { - let chars = if code == VST_FNENTRY { 2 } else { 1 }; + let (ids, chars) = match code { + VST_ENTRY => ([4, 5, 6], 1), + VST_BBENTRY => ([4, 4, 7], 1), + VST_FNENTRY => ([8, 9, 10], 2), + _ => return w.record(code, ops), + }; let name: Vec = ops[chars..] .iter() .map(|&c| u8::try_from(c).expect("a byte")) .collect(); - let width = name_width(&name); - let id = match code { - VST_ENTRY => [4, 5, 6][width], - VST_BBENTRY => [4, 4, 7][width], - VST_FNENTRY => [8, 9, 10][width], - _ => return w.record(code, ops), - }; - w.abbreviated(id, code, ops, None); + w.abbreviated(ids[name_width(&name)], code, ops, None); } /// Copy the rest of block `id`, just entered, as read (a function's symbol table spelled as