diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/endian.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/common/endian.h b/common/endian.h index 7278265961..e924b5142d 100644 --- a/common/endian.h +++ b/common/endian.h @@ -608,4 +608,36 @@ inline uint32 READ_BE_UINT24(const void *ptr) { #define READ_UINT24(a) READ_BE_UINT24(a) #endif +inline int16 READ_LE_INT16(const void *ptr) { + return static_cast<int16>(READ_LE_UINT16(ptr)); +} + +inline void WRITE_LE_INT16(void *ptr, int16 value) { + WRITE_LE_UINT16(ptr, static_cast<uint16>(value)); +} + +inline int16 READ_BE_INT16(const void *ptr) { + return static_cast<int16>(READ_BE_UINT16(ptr)); +} + +inline void WRITE_BE_INT16(void *ptr, int16 value) { + WRITE_BE_UINT16(ptr, static_cast<uint16>(value)); +} + +inline int32 READ_LE_INT32(const void *ptr) { + return static_cast<int32>(READ_LE_UINT32(ptr)); +} + +inline void WRITE_LE_INT32(void *ptr, int32 value) { + WRITE_LE_UINT32(ptr, static_cast<uint32>(value)); +} + +inline int32 READ_BE_INT32(const void *ptr) { + return static_cast<int32>(READ_BE_UINT32(ptr)); +} + +inline void WRITE_BE_INT32(void *ptr, int32 value) { + WRITE_BE_UINT32(ptr, static_cast<uint32>(value)); +} + #endif |