1
0
Fork 0
forked from koniifer/ableos
This commit is contained in:
Erin 2024-02-16 12:17:15 +01:00
parent eb46b24a10
commit 6c6e29479f

View file

@ -127,6 +127,14 @@ macro_rules! gen_opcodes {
[< $mnemonic:lower:camel >](super::[<Ops $ty>]), [< $mnemonic:lower:camel >](super::[<Ops $ty>]),
)* } )* }
impl Op {
pub fn size(&self) -> usize {
(match self {
$(Self::[<$mnemonic:lower:camel>] { .. } => core::mem::size_of::<super::[<Ops $ty>]>(),)*
}) + 1
}
}
impl crate::Encodable for Op { impl crate::Encodable for Op {
fn encode(self, buffer: &mut impl crate::Buffer) { fn encode(self, buffer: &mut impl crate::Buffer) {
match self { match self {