git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a7e6471
)
improved byte order handling
author
kramm
<kramm>
Sat, 5 Jan 2002 16:29:34 +0000
(16:29 +0000)
committer
kramm
<kramm>
Sat, 5 Jan 2002 16:29:34 +0000
(16:29 +0000)
lib/rfxswf.h
patch
|
blob
|
history
diff --git
a/lib/rfxswf.h
b/lib/rfxswf.h
index
985be86
..
ca8bdb3
100644
(file)
--- a/
lib/rfxswf.h
+++ b/
lib/rfxswf.h
@@
-29,12
+29,18
@@
#define FALSE (0)
#endif
#define FALSE (0)
#endif
+//#define SWAP16(s) ((U16) ((U8*)&s)[0] | ((U16) ((U8*)&s)[1] << 8))
+//#define SWAP32(s) ((U32) ((U8*)&s)[0] | ((U32) ((U8*)&s)[1] << 8) | ((U32) ((U8*)&s)[2] << 16) | ((U32) ((U8*)&s)[3] << 24))
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
-#define SWAP16(s) ((U16) ((U8*)&s)[0] | ((U16) ((U8*)&s)[1] << 8))
-#define SWAP32(s) ((U32) ((U8*)&s)[0] | ((U32) ((U8*)&s)[1] << 8) | ((U32) ((U8*)&s)[2] << 16) | ((U32) ((U8*)&s)[3] << 24))
+#define SWAP16(s) ((((s)>>8)&0x00ff)|(((s)<<8)&0xff00))
+#define SWAP32(s) (SWAP16(((s)>>16)&0x0000ffff)|((SWAP16(s)<<16)&0xffff0000))
+#define REVERSESWAP16(x) (x)
+#define REVERSESWAP32(x) (x)
#else
#else
-#define SWAP16(x) x
-#define SWAP32(x) x
+#define SWAP16(x) (x)
+#define SWAP32(x) (x)
+#define REVERSESWAP16(s) ((((s)>>8)&0x00ff)|(((s)<<8)&0xff00))
+#define REVERSESWAP32(s) (REVERSESWAP16(((s)>>16)&0x0000ffff)|((REVERSESWAP16(s)<<16)&0xffff0000))
#endif
// SWF Types
#endif
// SWF Types