#[repr(u8)]
pub enum AluOp {
Show 14 variants
ADD,
SUB,
MUL,
DIV,
OR,
AND,
LSH,
RSH,
NEG,
MOD,
XOR,
MOV,
ARSH,
END,
}
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
dst += src
SUB
dst -= src
MUL
dst *= src
DIV
dst /= src
OR
dst |= src
AND
dst &= src
LSH
dst <<= src
RSH
dst >>= src
NEG
dst = ~src
MOD
dst %= src
XOR
dst ^= src
MOV
dst = src
ARSH
dst >>= src
(with sign extension)
END
Byte swap operations. See kernel docs
Trait Implementations
sourceimpl TryFrom<u8> for AluOp
impl TryFrom<u8> for AluOp
type Error = TryFromPrimitiveError<AluOp>
type Error = TryFromPrimitiveError<AluOp>
The type returned in the event of a conversion error.
sourcefn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>
fn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>
Performs the conversion.
sourceimpl TryFromPrimitive for AluOp
impl TryFromPrimitive for AluOp
type Primitive = u8
const NAME: &'static str = "AluOp"
fn try_from_primitive(
number: Self::Primitive
) -> Result<Self, TryFromPrimitiveError<Self>>
impl Copy for AluOp
impl Eq for AluOp
impl StructuralEq for AluOp
impl StructuralPartialEq for AluOp
Auto Trait Implementations
impl RefUnwindSafe for AluOp
impl Send for AluOp
impl Sync for AluOp
impl Unpin for AluOp
impl UnwindSafe for AluOp
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more