#[repr(u8)]pub enum AluOp {
Show 14 variants
ADD = 0,
SUB = 16,
MUL = 32,
DIV = 48,
OR = 64,
AND = 80,
LSH = 96,
RSH = 112,
NEG = 128,
MOD = 144,
XOR = 160,
MOV = 176,
ARSH = 192,
END = 208,
}
Expand description
Arithmetic instructions
These are meant to be used with the BPF_ALU and BPF_ALU64 instruction classes.
In the pseudo-code described below, dst
and src
can refer to registers or immediate values
depending on other bits set within the opcode.
Source: kernel tree
Variants§
ADD = 0
dst += src
SUB = 16
dst -= src
MUL = 32
dst *= src
DIV = 48
dst /= src
OR = 64
dst |= src
AND = 80
dst &= src
LSH = 96
dst <<= src
RSH = 112
dst >>= src
NEG = 128
dst = ~src
MOD = 144
dst %= src
XOR = 160
dst ^= src
MOV = 176
dst = src
ARSH = 192
dst >>= src
(with sign extension)
END = 208
Byte swap operations. See kernel docs
Trait Implementations§
Source§impl TryFromPrimitive for AluOp
impl TryFromPrimitive for AluOp
impl Copy for AluOp
impl Eq for AluOp
impl StructuralPartialEq for AluOp
Auto Trait Implementations§
impl Freeze for AluOp
impl RefUnwindSafe for AluOp
impl Send for AluOp
impl Sync for AluOp
impl Unpin for AluOp
impl UnwindSafe for AluOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more