From 33ef0d0a4b4cae8ab27b87725c03261deba26734 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Apr 2004 20:28:42 +0000 Subject: Added signed read/write methods to the Stream classes svn-id: r13680 --- common/stream.cpp | 35 +++++++++++++++++++++++++++++++++++ common/stream.h | 4 ---- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/stream.cpp b/common/stream.cpp index c4fdb29f09..e151c058ce 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -59,6 +59,24 @@ uint32 ReadStream::readUint32BE() { } +int16 ReadStream::readSint16LE() { + return (int16)readUint16LE(); +} + +int32 ReadStream::readSint32LE() { + return (int32)readUint32LE(); +} + +int16 ReadStream::readSint16BE() { + return (int16)readUint16BE(); +} + +int32 ReadStream::readSint32BE() { + return (int32)readUint32BE(); +} + + + void WriteStream::writeByte(byte value) { write(&value, 1); } @@ -83,4 +101,21 @@ void WriteStream::writeUint32BE(uint32 value) { writeUint16BE((uint16)(value & 0xffff)); } + +void WriteStream::writeSint16LE(int16 value) { + writeUint16LE((uint16)value); +} + +void WriteStream::writeSint32LE(int32 value) { + writeUint32LE((uint32)value); +} + +void WriteStream::writeSint16BE(int16 value) { + writeUint16BE((uint16)value); +} + +void WriteStream::writeSint32BE(int32 value) { + writeUint32BE((uint32)value); +} + } // End of namespace Common diff --git a/common/stream.h b/common/stream.h index e5fdd96b09..1707f0e696 100644 --- a/common/stream.h +++ b/common/stream.h @@ -43,13 +43,11 @@ public: void writeUint16BE(uint16 value); void writeUint32BE(uint32 value); -/* void writeSint16LE(int16 value); void writeSint32LE(int32 value); void writeSint16BE(int16 value); void writeSint32BE(int32 value); -*/ }; @@ -67,13 +65,11 @@ public: uint16 readUint16BE(); uint32 readUint32BE(); -/* int16 readSint16LE(); int32 readSint32LE(); int16 readSint16BE(); int32 readSint32BE(); -*/ }; /** -- cgit v1.2.3