2025-04-14 22:08:50 +03:00
|
|
|
namespace X86Disassembler.X86;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Base class for all x86 instruction operands
|
|
|
|
/// </summary>
|
|
|
|
public abstract class Operand
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the type of this operand
|
|
|
|
/// </summary>
|
|
|
|
public OperandType Type { get; protected set; }
|
|
|
|
|
|
|
|
/// <summary>
|
2025-04-16 18:30:17 +03:00
|
|
|
/// Gets the size of the operand in bits (8, 16, 32)
|
2025-04-14 22:08:50 +03:00
|
|
|
/// </summary>
|
2025-04-16 18:30:17 +03:00
|
|
|
public int Size { get; protected set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sets the size of the operand in bits
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="size">The new size in bits (8, 16, 32, or 64)</param>
|
|
|
|
/// <returns>The operand instance for method chaining</returns>
|
|
|
|
public virtual Operand WithSize(int size)
|
|
|
|
{
|
|
|
|
Size = size;
|
|
|
|
return this;
|
|
|
|
}
|
2025-04-14 22:08:50 +03:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a string representation of this operand
|
|
|
|
/// </summary>
|
|
|
|
public abstract override string ToString();
|
|
|
|
}
|