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 {