Mercurial > sdl-ios-xcode
comparison include/SDL_endian.h @ 4438:7a53f8efc017 SDL-1.2
esigra 2010-04-17 03:53:57 PDT
If this header file is supposed to be includable from C++ code, the code should
of course use one of the SDL_*_cast macros from SDL_stdinc.h.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 23 Apr 2010 02:14:06 -0700 |
parents | d660ca4f7b1f |
children | a5865d4b6495 |
comparison
equal
deleted
inserted
replaced
4431:d660ca4f7b1f | 4438:7a53f8efc017 |
---|---|
92 __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc"); | 92 __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc"); |
93 return x; | 93 return x; |
94 } | 94 } |
95 #else | 95 #else |
96 static __inline__ Uint16 SDL_Swap16(Uint16 x) { | 96 static __inline__ Uint16 SDL_Swap16(Uint16 x) { |
97 return (Uint16)((x<<8)|(x>>8)); | 97 return SDL_static_cast(Uint16, ((x<<8)|(x>>8))); |
98 } | 98 } |
99 #endif | 99 #endif |
100 | 100 |
101 #if defined(__GNUC__) && defined(__i386__) && \ | 101 #if defined(__GNUC__) && defined(__i386__) && \ |
102 !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) | 102 !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) |
127 __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc"); | 127 __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc"); |
128 return x; | 128 return x; |
129 } | 129 } |
130 #else | 130 #else |
131 static __inline__ Uint32 SDL_Swap32(Uint32 x) { | 131 static __inline__ Uint32 SDL_Swap32(Uint32 x) { |
132 return (Uint32)((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)); | 132 return SDL_static_cast(Uint32, ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24))); |
133 } | 133 } |
134 #endif | 134 #endif |
135 | 135 |
136 #ifdef SDL_HAS_64BIT_TYPE | 136 #ifdef SDL_HAS_64BIT_TYPE |
137 #if defined(__GNUC__) && defined(__i386__) && \ | 137 #if defined(__GNUC__) && defined(__i386__) && \ |