From 8d1522b6cb519a8550de15a2d3813701232f00da Mon Sep 17 00:00:00 2001 From: bird_egop Date: Sun, 13 Apr 2025 23:36:53 +0300 Subject: [PATCH] Added XML documentation comments to buffer reading methods in InstructionDecoder --- X86Disassembler/X86/InstructionDecoder.cs | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/X86Disassembler/X86/InstructionDecoder.cs b/X86Disassembler/X86/InstructionDecoder.cs index ef4112a..846dee4 100644 --- a/X86Disassembler/X86/InstructionDecoder.cs +++ b/X86Disassembler/X86/InstructionDecoder.cs @@ -227,6 +227,33 @@ public class InstructionDecoder { return _prefixDecoder.HasOperandSizePrefix(); } + + /// + /// Checks if a single byte can be read from the current position + /// + /// True if there is at least one byte available to read + public bool CanReadByte() + { + return _position < _length; + } + + /// + /// Checks if a 16-bit unsigned short (2 bytes) can be read from the current position + /// + /// True if there are at least two bytes available to read + public bool CanReadUShort() + { + return _position + 1 < _length; + } + + /// + /// Checks if a 32-bit unsigned integer (4 bytes) can be read from the current position + /// + /// True if there are at least four bytes available to read + public bool CanReadUInt() + { + return _position + 3 < _length; + } /// /// Reads a byte from the buffer and advances the position