namespace X86Disassembler.X86; /// /// Handles mapping between register indices and register enums /// public static class RegisterMapper { /// /// Gets the register name based on the register index and size /// /// The register index as RegisterIndex enum /// The register size (16, 32, or 64 bits) /// The register name public static string GetRegisterName(RegisterIndex regIndex, int size) { return size switch { 16 => Constants.RegisterNames16[(int)regIndex], 32 => Constants.RegisterNames32[(int)regIndex], 64 => Constants.RegisterNames32[(int)regIndex], // For now, reuse 32-bit names for 64-bit _ => "unknown" }; } /// /// Gets the 8-bit register name based on the RegisterIndex8 enum value /// /// The register index as RegisterIndex8 enum /// The 8-bit register name public static string GetRegisterName(RegisterIndex8 regIndex8) { return regIndex8.ToString().ToLower(); } }