mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
COMMON: Improve ReadStreamEndian implementation
The commit does not change the behaviour of the class but makes
its implementation more logical, and in line with how it was
originaly implemented (before being refactored in commit 1011508
).
Both FROM_BE_* and TO_BE_* do the same thingi for example, but you
use this stream class to read from a BE or LE stream and convert
the values to native endianness, and thus it makes more sense to
use FROM_BE_* and FROM_LE_* instead of TO_BE_* and TO_LE_* (which
suggested that we read values in native endianness and then
convert to the specified endianness).
This commit is contained in:
parent
a509afdf4d
commit
0575130b35
@ -686,19 +686,19 @@ public:
|
||||
uint16 readUint16() {
|
||||
uint16 val;
|
||||
read(&val, 2);
|
||||
return (_bigEndian) ? TO_BE_16(val) : TO_LE_16(val);
|
||||
return (_bigEndian) ? FROM_BE_16(val) : FROM_LE_16(val);
|
||||
}
|
||||
|
||||
uint32 readUint32() {
|
||||
uint32 val;
|
||||
read(&val, 4);
|
||||
return (_bigEndian) ? TO_BE_32(val) : TO_LE_32(val);
|
||||
return (_bigEndian) ? FROM_BE_32(val) : FROM_LE_32(val);
|
||||
}
|
||||
|
||||
uint64 readUint64() {
|
||||
uint64 val;
|
||||
read(&val, 8);
|
||||
return (_bigEndian) ? TO_BE_64(val) : TO_LE_64(val);
|
||||
return (_bigEndian) ? FROM_BE_64(val) : FROM_LE_64(val);
|
||||
}
|
||||
|
||||
FORCEINLINE int16 readSint16() {
|
||||
|
Loading…
Reference in New Issue
Block a user