mirror of
https://github.com/hch12907/orbum.git
synced 2024-06-02 19:38:16 -04:00
Minor optimization
Using const allows the compiler to perform more optimisations
This commit is contained in:
parent
750b3e8143
commit
17ce65d4e9
|
@ -27,14 +27,13 @@ public:
|
|||
/// Read/write floats - wrappers around read/write uword.
|
||||
f32 read_float(const size_t offset)
|
||||
{
|
||||
uword raw = read_uword(offset);
|
||||
return *reinterpret_cast<f32*>(&raw);
|
||||
const uword raw = read_uword(offset);
|
||||
return *reinterpret_cast<const f32*>(&raw);
|
||||
}
|
||||
|
||||
void write_float(const size_t offset, const f32 value)
|
||||
{
|
||||
f32 raw = value;
|
||||
write_uword(offset, *reinterpret_cast<uword*>(&raw));
|
||||
write_uword(offset, *reinterpret_cast<const uword*>(&value));
|
||||
}
|
||||
|
||||
/// ByteBusMappable overrides.
|
||||
|
|
|
@ -24,14 +24,13 @@ public:
|
|||
/// Read/write floats - wrappers around read/write uword.
|
||||
f32 read_float()
|
||||
{
|
||||
uword raw = read_uword();
|
||||
return *reinterpret_cast<f32*>(&raw);
|
||||
const uword raw = read_uword();
|
||||
return *reinterpret_cast<const f32*>(&raw);
|
||||
}
|
||||
|
||||
void write_float(const f32 value)
|
||||
{
|
||||
f32 raw = value;
|
||||
write_uword(*reinterpret_cast<uword*>(&raw));
|
||||
write_uword(*reinterpret_cast<const uword*>(&value));
|
||||
}
|
||||
|
||||
/// Bitfield extraction/insertion.
|
||||
|
|
Loading…
Reference in a new issue