diff --git a/hbbytecode/src/lib.rs b/hbbytecode/src/lib.rs index 32a09329..fcd3103d 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 {