Inline fast case for random access file byte/word/dword read

This commit is contained in:
Jonathan G Rennison
2021-05-30 11:24:43 +01:00
parent 054c820521
commit f212332359
2 changed files with 45 additions and 10 deletions

View File

@@ -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;
}
/**