Skip to main content

lua_types/
arith.rs

1//! Arithmetic operations — used by lvm's arith dispatch.
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4#[repr(u8)]
5pub enum ArithOp {
6    Add  = 0,
7    Sub  = 1,
8    Mul  = 2,
9    Mod  = 3,
10    Pow  = 4,
11    Div  = 5,
12    Idiv = 6,
13    Band = 7,
14    Bor  = 8,
15    Bxor = 9,
16    Shl  = 10,
17    Shr  = 11,
18    Unm  = 12,
19    Bnot = 13,
20}
21
22// ──────────────────────────────────────────────────────────────────────────────
23// PORT STATUS
24//   source:        src/lvm.c arith helpers (luaV_arith / luaV_lessthan / ...)
25//   target_crate:  lua-types
26//   confidence:    high
27//   todos:         0
28//   port_notes:    0
29//   unsafe_blocks: 0
30//   notes:         Arith opcode kind enum and operand-promotion helpers shared by
31//                  lua-vm's OP_ADD / OP_SUB / ... handlers. Mirrors the C lvm.c
32//                  intop+/tonumber+ patterns.
33// ──────────────────────────────────────────────────────────────────────────────