aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2015-02-20 21:23:21 +0200
committerEugene Sandulenko2015-12-15 00:05:02 +0100
commit7e0545cf6d3f4dd3628119cf61910be5ca0fb340 (patch)
tree7366c90b813fc817e6286a2ee871f16639aeb97b /engines
parentd25d74ef2033835514242584562f7433deeb52c8 (diff)
downloadscummvm-rg350-7e0545cf6d3f4dd3628119cf61910be5ca0fb340.tar.gz
scummvm-rg350-7e0545cf6d3f4dd3628119cf61910be5ca0fb340.tar.bz2
scummvm-rg350-7e0545cf6d3f4dd3628119cf61910be5ca0fb340.zip
LAB: Remove unused byte swap code
The relevant defines will be replaced with the ones from our common code
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/machine.cpp130
-rw-r--r--engines/lab/stddefines.h16
-rw-r--r--engines/lab/undiff.cpp69
3 files changed, 4 insertions, 211 deletions
diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp
index c1bdd003b8..3806b5f6e1 100644
--- a/engines/lab/machine.cpp
+++ b/engines/lab/machine.cpp
@@ -218,134 +218,4 @@ char *translateFileName(const char *filename) {
return NewFileName;
}
-#if defined(USE_SWAP)
-
-uint16 swapUShort(uint16 value) {
- char *b = (char *)&value;
- char t = b[0];
- b[0] = b[1];
- b[1] = t;
- return value;
-}
-uint16 *wapUShortPtsr(uint16 *ptr, int count) {
- while (count-- > 0) {
- char *b = (char *)ptr++;
- char t = b[0];
- b[0] = b[1];
- b[1] = t;
- }
-
- return ptr;
-}
-int16 swapShort(int16 value) {
- char *b = (char *)&value;
- char t = b[0];
- b[0] = b[1];
- b[1] = t;
- return value;
-}
-int16 *swapShortPtr(int16 *ptr, int count) {
- while (count-- > 0) {
- char *b = (char *)ptr++;
- char t = b[0];
- b[0] = b[1];
- b[1] = t;
- }
-
- return ptr;
-}
-unsigned int swapUInt(unsigned int value) {
- char *b = (char *)&value;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- return value;
-}
-unsigned int *swapUIntPtr(unsigned int *ptr, int count) {
- while (count-- > 0) {
- char *b = (char *)ptr++;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- }
-
- return ptr;
-}
-int swapInt(int value) {
- char *b = (char *)&value;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- return value;
-}
-int *swapIntPtr(int *ptr, int count) {
- while (count-- > 0) {
- char *b = (char *)ptr++;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- }
-
- return ptr;
-}
-uint32 swapULong(uint32 value) {
- char *b = (char *)&value;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- return value;
-}
-uint32 *swapULongPtr(uint32 *ptr, int count) {
- while (count-- > 0) {
- char *b = (char *)ptr++;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- }
-
- return ptr;
-}
-int32 swapLong(int32 value) {
- char *b = (char *)&value;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- return value;
-}
-int32 *swapLongPtr(int32 *ptr, int count) {
- while (count-- > 0) {
- char *b = (char *)ptr++;
- char t = b[0];
- b[0] = b[3];
- b[3] = t;
- t = b[1];
- b[1] = b[2];
- b[2] = t;
- }
-
- return ptr;
-}
-#endif
-
} // End of namespace Lab
diff --git a/engines/lab/stddefines.h b/engines/lab/stddefines.h
index 3729084618..67bd39a47d 100644
--- a/engines/lab/stddefines.h
+++ b/engines/lab/stddefines.h
@@ -38,14 +38,12 @@
namespace Lab {
#define IS_MACOSX 1
-#define USE_NOSWAP 1
#if defined(IS_MACOSX)
#define getTime Lab_GetTime
#define delay Lab_Delay
#endif
-#if defined(USE_NOSWAP)
#define swapUShort(value) (value)
#define swapUShortPtr(ptr,count) (ptr)
#define swapShort(value) (value)
@@ -58,20 +56,6 @@ namespace Lab {
#define swapULongPtr(ptr,count) (ptr)
#define swapLong(value) (value)
#define swapLongPtr(ptr,count) (ptr)
-#else
-uint16 swapUShort(uint16 value);
-uint16 *swapUShortPtr(uint16 *ptr, int count);
-int16 swapShort(int16 value);
-int16 *swapShortPtr(int16 *ptr, int count);
-unsigned int swapUInt(unsigned int value);
-unsigned int *swapUIntPtr(unsigned int *ptr, int count);
-int swapInt(int value);
-int *swapIntPtr(int *ptr, int count);
-uint32 swapULong(uint32 value);
-uint32 *swapULongPtr(uint32 *ptr, int count);
-int32 swapLong(int32 value);
-int32 *swapLongPtr(int32 *ptr, int count);
-#endif
} // End of namespace Lab
diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp
index 2218db485a..bc4eacc603 100644
--- a/engines/lab/undiff.cpp
+++ b/engines/lab/undiff.cpp
@@ -39,8 +39,6 @@ extern uint16 DataBytesPerRow;
/*****************************************************************************/
/* Copies memory. */
/*****************************************************************************/
-#define turbocopymem(Dest, Source, Len) (memcpy(Dest, Source, Len))
-
static void copytwo(byte *Dest, byte *Source) {
#if defined(USE_SWAP)
@@ -86,7 +84,7 @@ static void unDIFFByteByte(byte *Dest, byte *diff) {
}
Dest += skip;
- turbocopymem(Dest, diff, copy);
+ memcpy(Dest, diff, copy);
Dest += copy;
diff += copy;
}
@@ -150,42 +148,6 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) {
-#ifdef undef
-
-/*****************************************************************************/
-/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
-/* is a long word. */
-/*****************************************************************************/
-static void unDIFFByteLong(byte *Dest, byte *diff) {
- uint16 skip, copy;
-
- while (1) {
- skip = *diff << 2;
- diff++;
- copy = *diff << 2;
- diff++;
-
- if (skip == (255 << 2)) {
- if (copy == 0) {
- skip = swapUShort(*((uint16 *) diff)) << 2;
- diff += 2;
- copy = swapUShort(*((uint16 *) diff) << 2;
- diff += 2;
- } else if (copy == (255 << 2))
- return;
- }
-
- Dest += skip;
- turbocopymem(Dest, diff, copy);
- Dest += copy;
- diff += copy;
- }
-}
-
-#endif
-
-
-
/*****************************************************************************/
/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */
/*****************************************************************************/
@@ -197,33 +159,10 @@ bool unDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize) {
else if (CopySize == 2)
unDIFFByteWord((uint16 *)Dest, (uint16 *)diff);
-#ifdef undef
- else if (CopySize == 4)
- unDIFFByteLong((uint32 *)Dest, (uint32 *)diff);
-
-#endif
-
else
return false;
- }
- /*
- else if (HeaderSize == 2)
- {
- if (CopySize == 1)
- unDIFFWordByte(Dest, diff);
-
- else if (CopySize == 2)
- unDIFFWordWord(Dest, diff);
-
- else if (CopySize == 4)
- unDIFFWordLong(Dest, diff);
-
- else
- return false;
- }
- */
- else
- return (false);
+ } else
+ error("unDIFFMemory: HeaderSize is %d", HeaderSize);
return true;
}
@@ -431,7 +370,7 @@ void runLengthDecode(byte *Dest, byte *Source) {
if (num == 127) {
return;
} else if (num > '\0') {
- turbocopymem(Dest, Source, num);
+ memcpy(Dest, Source, num);
Source += num;
Dest += num;
} else {