#[repr(C)]
pub struct X86Operand { pub operand: OperandType, pub components: [OperandType; 2], pub scale: u8, pub size: u16, pub immediate: isize, pub segment: SegmentRegister, }
Expand description

An operand for an Instruction.

The type of operand is given by the operand member. If the type is OperandType::NONE, none of the other members are defined.

If the operand type is not OperandType::NONE, then the size field is valid.

If the type is OperandType::IMM, then the operand is a constant integer contained in the immediate member.

If the type is OperandType::MEM, then the operand is a memory reference and the other members are used as defined.

The address of a memory reference is effectively the following formula, where references to the component array should look up the current value should look up the current value of the register or substitute zero if the value is OperandType::NONE:

address = components[0] + components[1] * scale + immediate

TODO: Perhaps this should be an enumeration with separate values for invalid, immediate value, a memory reference or a register.

Fields

operand: OperandType

The type of the operand, a register or one of a set of special values.

components: [OperandType; 2]

The address components of a memory operand.

scale: u8

If this is a memory operand, then this value is used to scale the second component.

size: u16

The size of the operand in bytes. For register operands, this is the size of the register. For memory operands, this is the size of the memory access.

immediate: isize

The value of a constant integer when the operand is the IMM type. When the operand is a memory reference, this contains a constant offset for the memory reference.

segment: SegmentRegister

The segment register that will be used for a memory access. This will always contain a segment register, as SegmentRegister::DEFAULT is resolved to the default register.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.