Inline fast case for random access file byte/word/dword read
This commit is contained in:
@@ -97,7 +97,7 @@ void RandomAccessFile::SeekTo(size_t pos, int mode)
|
||||
* Read a byte from the file.
|
||||
* @return Read byte.
|
||||
*/
|
||||
byte RandomAccessFile::ReadByte()
|
||||
byte RandomAccessFile::ReadByteIntl()
|
||||
{
|
||||
if (this->buffer == this->buffer_end) {
|
||||
this->buffer = this->buffer_start;
|
||||
@@ -114,20 +114,20 @@ byte RandomAccessFile::ReadByte()
|
||||
* Read a word (16 bits) from the file (in low endian format).
|
||||
* @return Read word.
|
||||
*/
|
||||
uint16 RandomAccessFile::ReadWord()
|
||||
uint16 RandomAccessFile::ReadWordIntl()
|
||||
{
|
||||
byte b = this->ReadByte();
|
||||
return (this->ReadByte() << 8) | b;
|
||||
byte b = this->ReadByteIntl();
|
||||
return (this->ReadByteIntl() << 8) | b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a double word (32 bits) from the file (in low endian format).
|
||||
* @return Read word.
|
||||
*/
|
||||
uint32 RandomAccessFile::ReadDword()
|
||||
uint32 RandomAccessFile::ReadDwordIntl()
|
||||
{
|
||||
uint b = this->ReadWord();
|
||||
return (this->ReadWord() << 16) | b;
|
||||
uint b = this->ReadWordIntl();
|
||||
return (this->ReadWordIntl() << 16) | b;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user