mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 16:18:37 +03:00
more refactoring
This commit is contained in:
@ -28,7 +28,7 @@ public class AdcImmToRm32SignExtendedHandler : InstructionHandler
|
||||
|
||||
// Check if the reg field of the ModR/M byte is 2 (ADC)
|
||||
int position = Decoder.GetPosition();
|
||||
if (position >= Length)
|
||||
if (!Decoder.CanReadByte())
|
||||
return false;
|
||||
|
||||
byte modRM = CodeBuffer[position];
|
||||
@ -48,9 +48,7 @@ public class AdcImmToRm32SignExtendedHandler : InstructionHandler
|
||||
// Set the mnemonic
|
||||
instruction.Mnemonic = "adc";
|
||||
|
||||
int position = Decoder.GetPosition();
|
||||
|
||||
if (position >= Length)
|
||||
if (!Decoder.CanReadByte())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -58,13 +56,12 @@ public class AdcImmToRm32SignExtendedHandler : InstructionHandler
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Read the immediate value (sign-extended from 8 to 32 bits)
|
||||
if (position >= Length)
|
||||
if (!Decoder.CanReadByte())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sign-extend to 32 bits
|
||||
// Read the immediate value (sign-extended from 8 to 32 bits)
|
||||
int imm32 = (sbyte) Decoder.ReadByte();
|
||||
|
||||
// Set the operands
|
||||
|
Reference in New Issue
Block a user