[Scummvm-git-logs] scummvm master -> d2a7c296a2dc7d3f7618acd5785f59ee8508a1f0

sev- sev at scummvm.org
Sun Jul 30 22:03:32 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d2a7c296a2 COMMON: Migrate Various Endian Functions to Common from Engine Code.


Commit: d2a7c296a2dc7d3f7618acd5785f59ee8508a1f0
    https://github.com/scummvm/scummvm/commit/d2a7c296a2dc7d3f7618acd5785f59ee8508a1f0
Author: D G Turner (digitall at scummvm.org)
Date: 2017-07-30T22:03:29+02:00

Commit Message:
COMMON: Migrate Various Endian Functions to Common from Engine Code.

Thanks to N.E.C <beholdnec at gmail.com> for this.

Changed paths:
    common/endian.h
    engines/hopkins/hopkins.h
    engines/lure/luredefs.h
    engines/queen/queen.h
    engines/toon/tools.h


diff --git a/common/endian.h b/common/endian.h
index 7278265..e924b51 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
diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h
index 30140ba..3528a98 100644
--- a/engines/hopkins/hopkins.h
+++ b/engines/hopkins/hopkins.h
@@ -72,8 +72,6 @@ enum HopkinsDebugChannels {
  */
 #define MKTAG24(a0,a1,a2) ((uint32)((a2) | (a1) << 8 | ((a0) << 16)))
 
-#define READ_LE_INT16(x) (int16) READ_LE_UINT16(x)
-
 struct HopkinsGameDescription;
 
 class HopkinsEngine : public Engine {
diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h
index 7b39710..c6d0afa 100644
--- a/engines/lure/luredefs.h
+++ b/engines/lure/luredefs.h
@@ -37,9 +37,6 @@ namespace Lure {
 
 #define LURE_DEBUG 1
 
-#define READ_LE_INT16(x) (int16) READ_LE_UINT16(x)
-#define READ_LE_INT32(x) (int32) READ_LE_UINT32(x)
-
 enum {
 	kLureDebugScripts = 1 << 0,
 	kLureDebugAnimations = 1 << 1,
diff --git a/engines/queen/queen.h b/engines/queen/queen.h
index 789025c..3c38ccd 100644
--- a/engines/queen/queen.h
+++ b/engines/queen/queen.h
@@ -30,24 +30,6 @@ namespace Common {
 class SeekableReadStream;
 }
 
-#if defined(_WIN32_WCE) && (_WIN32_WCE <= 300)
-
-#include "common/endian.h"
-
-FORCEINLINE int16 READ_BE_INT16(const void *ptr) {
-	uint16 result;
-	char dummy[2];
-	result = READ_BE_UINT16(ptr);
-	strcpy(dummy, "x"); // Hello, I'm a drunk optimizer. Thanks for helping me.
-	return result;
-}
-
-#else
-
-#define READ_BE_INT16 READ_BE_UINT16
-
-#endif
-
 /**
  * This is the namespace of the Queen engine.
  *
diff --git a/engines/toon/tools.h b/engines/toon/tools.h
index d80ec00..1ba8ceb 100644
--- a/engines/toon/tools.h
+++ b/engines/toon/tools.h
@@ -36,12 +36,6 @@ const uint32 kCompSPCN = 0x5350434E;
 const uint32 kCompRNC1 = 0x524E4301;
 const uint32 kCompRNC2 = 0x524E4302;
 
-#define READ_LE_INT16(x) (int16) READ_LE_UINT16(x)
-#define READ_LE_INT32(x) (int32) READ_LE_UINT32(x)
-
-#define WRITE_LE_INT16(x, y)  WRITE_LE_UINT16(x, (int16)y)
-#define WRITE_LE_INT32(x, y)  WRITE_LE_UINT32(x, (int32)y)
-
 uint32 decompressSPCN(byte *src, byte *dst, uint32 dstsize);
 uint32 decompressLZSS(byte *src, byte *dst, int dstsize);
 





More information about the Scummvm-git-logs mailing list