diff options
author | Eugene Sandulenko | 2016-09-29 22:24:43 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-29 22:33:36 +0200 |
commit | 7ab0985ca8526d29c0d7f076746045b39267a23c (patch) | |
tree | 1eba7c003d8b811245de3e10a604dcbec63589f6 | |
parent | 789bb7a2810a1bee537229862037e1f11396e2e6 (diff) | |
download | scummvm-rg350-7ab0985ca8526d29c0d7f076746045b39267a23c.tar.gz scummvm-rg350-7ab0985ca8526d29c0d7f076746045b39267a23c.tar.bz2 scummvm-rg350-7ab0985ca8526d29c0d7f076746045b39267a23c.zip |
COMMON: Add ReadFloatLE to Common::ReadStream
-rw-r--r-- | common/stream.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/stream.h b/common/stream.h index c6c300fa97..e0ffc47d7f 100644 --- a/common/stream.h +++ b/common/stream.h @@ -402,6 +402,22 @@ public: #endif /** + * Read a 32-bit floating point value stored in little endian (LSB first) + * order from the stream and return it. + * Performs no error checking. The return value is undefined + * if a read error occurred (for which client code can check by + * calling err() and eos() ). + */ + FORCEINLINE float readFloatLE() { + uint32 n = readUint32LE(); + float f; + + memcpy(&f, &n, 4); + + return f; + } + + /** * Read the specified amount of data into a malloc'ed buffer * which then is wrapped into a MemoryReadStream. * The returned stream might contain less data than requested, |