[Scummvm-cvs-logs] SF.net SVN: scummvm: [21032] tools/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Mar 3 06:17:04 CET 2006
Revision: 21032
Author: fingolfin
Date: 2006-03-03 06:16:15 -0800 (Fri, 03 Mar 2006)
ViewCVS: http://svn.sourceforge.net/scummvm?rev=21032&view=rev
Log Message:
-----------
Added READ_* and WRITE_* inline functions to util.h (analog to their counterparts in the main ScummVM code); these are independant of any ENDIAN #defines
Modified Paths:
--------------
tools/trunk/compress_scumm_bun.cpp
tools/trunk/compress_scumm_san.cpp
tools/trunk/util.h
Modified: tools/trunk/compress_scumm_bun.cpp
===================================================================
--- tools/trunk/compress_scumm_bun.cpp 2006-03-03 14:15:13 UTC (rev 21031)
+++ tools/trunk/compress_scumm_bun.cpp 2006-03-03 14:16:15 UTC (rev 21032)
@@ -22,34 +22,6 @@
#include "compress.h"
-inline uint16 READ_LE_UINT16(const void *ptr) {
- const byte *b = (const byte *)ptr;
- return (b[1] << 8) + b[0];
-}
-
-inline void WRITE_LE_UINT16(void *ptr, uint16 value) {
- byte *b = (byte *)ptr;
- b[0] = (byte)(value >> 0);
- b[1] = (byte)(value >> 8);
-}
-
-inline uint16 READ_BE_UINT16(const void *ptr) {
- const byte *b = (const byte *)ptr;
- return (b[0] << 8) + b[1];
-}
-
-inline uint32 READ_BE_UINT32(const void *ptr) {
- const byte *b = (const byte*)ptr;
- return (b[0] << 24) + (b[1] << 16) + (b[2] << 8) + (b[3]);
-}
-
-inline void WRITE_BE_UINT16(void *ptr, uint16 value) {
- byte *b = (byte *)ptr;
- b[0] = (byte)(value >> 8);
- b[1] = (byte)(value >> 0);
-}
-
-
/*
* The "IMC" codec below (see cases 13 & 15 in decompressCodec) is actually a
* variant of the IMA codec, see also
Modified: tools/trunk/compress_scumm_san.cpp
===================================================================
--- tools/trunk/compress_scumm_san.cpp 2006-03-03 14:15:13 UTC (rev 21031)
+++ tools/trunk/compress_scumm_san.cpp 2006-03-03 14:16:15 UTC (rev 21032)
@@ -23,17 +23,6 @@
#include "compress.h"
#include "zlib.h"
-inline uint16 READ_LE_UINT16(const void *ptr) {
- const byte *b = (const byte *)ptr;
- return (b[1] << 8) + b[0];
-}
-
-inline void WRITE_LE_UINT16(void *ptr, uint16 value) {
- byte *b = (byte *)ptr;
- b[0] = (byte)(value >> 0);
- b[1] = (byte)(value >> 8);
-}
-
const char *tag2str(uint32 tag) {
static char str[5];
str[0] = (char)(tag >> 24);
Modified: tools/trunk/util.h
===================================================================
--- tools/trunk/util.h 2006-03-03 14:15:13 UTC (rev 21031)
+++ tools/trunk/util.h 2006-03-03 14:16:15 UTC (rev 21032)
@@ -90,6 +90,50 @@
#define TO_LE_16(a) (a)
#endif
+#define FORCEINLINE static inline
+
+FORCEINLINE uint16 READ_LE_UINT16(const void *ptr) {
+ const byte *b = (const byte *)ptr;
+ return (b[1] << 8) + b[0];
+}
+FORCEINLINE uint32 READ_LE_UINT32(const void *ptr) {
+ const byte *b = (const byte *)ptr;
+ return (b[3] << 24) + (b[2] << 16) + (b[1] << 8) + (b[0]);
+}
+FORCEINLINE void WRITE_LE_UINT16(void *ptr, uint16 value) {
+ byte *b = (byte *)ptr;
+ b[0] = (byte)(value >> 0);
+ b[1] = (byte)(value >> 8);
+}
+FORCEINLINE void WRITE_LE_UINT32(void *ptr, uint32 value) {
+ byte *b = (byte *)ptr;
+ b[0] = (byte)(value >> 0);
+ b[1] = (byte)(value >> 8);
+ b[2] = (byte)(value >> 16);
+ b[3] = (byte)(value >> 24);
+}
+
+FORCEINLINE uint16 READ_BE_UINT16(const void *ptr) {
+ const byte *b = (const byte *)ptr;
+ return (b[0] << 8) + b[1];
+}
+FORCEINLINE uint32 READ_BE_UINT32(const void *ptr) {
+ const byte *b = (const byte*)ptr;
+ return (b[0] << 24) + (b[1] << 16) + (b[2] << 8) + (b[3]);
+}
+FORCEINLINE void WRITE_BE_UINT16(void *ptr, uint16 value) {
+ byte *b = (byte *)ptr;
+ b[0] = (byte)(value >> 8);
+ b[1] = (byte)(value >> 0);
+}
+FORCEINLINE void WRITE_BE_UINT32(void *ptr, uint32 value) {
+ byte *b = (byte *)ptr;
+ b[0] = (byte)(value >> 24);
+ b[1] = (byte)(value >> 16);
+ b[2] = (byte)(value >> 8);
+ b[3] = (byte)(value >> 0);
+}
+
#if defined(__GNUC__)
#define NORETURN_PRE
#define NORETURN_POST __attribute__((__noreturn__))
More information about the Scummvm-git-logs
mailing list