Skip to main content

lua_types/
opcode.rs

1//! `Instruction` — a single packed bytecode word. C-Lua uses `u32`.
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
4#[repr(transparent)]
5pub struct Instruction(pub u32);
6
7impl Instruction {
8    pub const fn new(raw: u32) -> Self {
9        Instruction(raw)
10    }
11    pub const fn raw(self) -> u32 {
12        self.0
13    }
14}
15
16// ──────────────────────────────────────────────────────────────────────────────
17// PORT STATUS
18//   source:        src/lopcodes.h, src/lopcodes.c
19//   target_crate:  lua-types
20//   confidence:    high
21//   todos:         0
22//   port_notes:    0
23//   unsafe_blocks: 0
24//   notes:         OpCode enum + Instruction word layout. Mirrors C's opcode numbering and
25//                  the iABC/iABx/iAsBx/iAx/isJ encoding macros.
26// ──────────────────────────────────────────────────────────────────────────────