From 6c6e29479fef4b4c38db8cb55092a6de4536326f Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 16 Feb 2024 12:17:15 +0100 Subject: [PATCH] xyzzy --- hbbytecode/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hbbytecode/src/lib.rs b/hbbytecode/src/lib.rs index 32a0932..fcd3103 100644 --- a/hbbytecode/src/lib.rs +++ b/hbbytecode/src/lib.rs @@ -127,6 +127,14 @@ macro_rules! gen_opcodes { [< $mnemonic:lower:camel >](super::[]), )* } + impl Op { + pub fn size(&self) -> usize { + (match self { + $(Self::[<$mnemonic:lower:camel>] { .. } => core::mem::size_of::]>(),)* + }) + 1 + } + } + impl crate::Encodable for Op { fn encode(self, buffer: &mut impl crate::Buffer) { match self {