| 1 |
diff -up devil-1.7.8/src-IL/include/il_endian.h~ devil-1.7.8/src-IL/include/il_endian.h
|
| 2 |
--- devil-1.7.8/src-IL/include/il_endian.h~ 2009-03-08 08:10:08.000000000 +0100
|
| 3 |
+++ devil-1.7.8/src-IL/include/il_endian.h 2009-03-09 10:11:33.000000000 +0100
|
| 4 |
@@ -15,6 +15,10 @@
|
| 5 |
|
| 6 |
#include "il_internal.h"
|
| 7 |
|
| 8 |
+#ifdef GCC_X86_ASM
|
| 9 |
+#include <byteswap.h>
|
| 10 |
+#endif
|
| 11 |
+
|
| 12 |
#ifdef WORDS_BIGENDIAN // This is defined by ./configure.
|
| 13 |
#ifndef __BIG_ENDIAN__
|
| 14 |
#define __BIG_ENDIAN__ 1
|
| 15 |
@@ -104,9 +108,7 @@ INLINE void iSwapUShort(ILushort *s) {
|
| 16 |
}
|
| 17 |
#else
|
| 18 |
#ifdef GCC_X86_ASM
|
| 19 |
- asm("ror $8,%0"
|
| 20 |
- : "=r" (*s)
|
| 21 |
- : "0" (*s));
|
| 22 |
+ *s = __bswap_16(*s);
|
| 23 |
#else
|
| 24 |
*s = ((*s)>>8) | ((*s)<<8);
|
| 25 |
#endif //GCC_X86_ASM
|
| 26 |
@@ -127,8 +129,7 @@ INLINE void iSwapUInt(ILuint *i) {
|
| 27 |
}
|
| 28 |
#else
|
| 29 |
#ifdef GCC_X86_ASM
|
| 30 |
- asm("bswap %0;"
|
| 31 |
- : "+r" (*i));
|
| 32 |
+ *i = __bswap_32(*i);
|
| 33 |
#else
|
| 34 |
*i = ((*i)>>24) | (((*i)>>8) & 0xff00) | (((*i)<<8) & 0xff0000) | ((*i)<<24);
|
| 35 |
#endif //GCC_X86_ASM
|