mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Common: avoid redefining bswap* via <sys/types.h> on BSDs
In file included from Common/CPUDetect.cpp:27: In file included from Common/Common.h:139: Common/Swap.h:76:23: error: C++ requires a type specifier for all declarations inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); } ^ /usr/include/sys/endian.h:59:20: note: expanded from macro 'bswap16' ^ /usr/include/x86/endian.h:74:16: note: expanded from macro '__bswap16' ((__uint16_t)(__builtin_constant_p(x) ? \ ^ In file included from Common/CPUDetect.cpp:27: In file included from Common/Common.h:139: Common/Swap.h:76:23: error: expected ')' /usr/include/sys/endian.h:59:20: note: expanded from macro 'bswap16' ^ /usr/include/x86/endian.h:74:40: note: expanded from macro '__bswap16' ((__uint16_t)(__builtin_constant_p(x) ? \ ^ Common/Swap.h:76:23: note: to match this '(' /usr/include/sys/endian.h:59:20: note: expanded from macro 'bswap16' ^ /usr/include/x86/endian.h:74:15: note: expanded from macro '__bswap16' ((__uint16_t)(__builtin_constant_p(x) ? \ ^ In file included from Common/CPUDetect.cpp:27: In file included from Common/Common.h:139: Common/Swap.h:76:59: error: use of undeclared identifier 'x' inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); } ^ Common/Swap.h:76:70: error: use of undeclared identifier 'x' inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); } ^ Common/Swap.h:77:21: error: expected ')' inline unsigned int bswap32(unsigned int x) { return (x >> 24) | ((x & 0xFF0... ^ /usr/include/sys/endian.h:60:20: note: expanded from macro 'bswap32' ^ /usr/include/x86/endian.h:77:27: note: expanded from macro '__bswap32' (__builtin_constant_p(x) ? \ ^ Common/Swap.h:77:21: note: to match this '(' /usr/include/sys/endian.h:60:20: note: expanded from macro 'bswap32' ^ /usr/include/x86/endian.h:77:2: note: expanded from macro '__bswap32' (__builtin_constant_p(x) ? \ ^ In file included from Common/CPUDetect.cpp:27: In file included from Common/Common.h:139: Common/Swap.h:77:21: error: functions that differ only in their return type cannot be overloaded inline unsigned int bswap32(unsigned int x) { return (x >> 24) | ((x & 0xFF0... ^ /usr/include/sys/endian.h:60:20: note: expanded from macro 'bswap32' ^ /usr/include/x86/endian.h:77:3: note: expanded from macro '__bswap32' (__builtin_constant_p(x) ? \ ^ native/base/basictypes.h:92:44: note: previous implicit declaration is here inline uint16 swap16(uint16 _data) {return bswap16(_data);} ^ /usr/include/sys/endian.h:59:20: note: expanded from macro 'bswap16' ^ /usr/include/x86/endian.h:74:16: note: expanded from macro '__bswap16' ((__uint16_t)(__builtin_constant_p(x) ? \ ^ In file included from Common/CPUDetect.cpp:27: In file included from Common/Common.h:139: Common/Swap.h:78:27: error: expected ')' inline unsigned long long bswap64(unsigned long long x) { return ((unsigned ... ^ /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' ^ /usr/include/x86/endian.h:80:27: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ Common/Swap.h:78:27: note: to match this '(' /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' ^ /usr/include/x86/endian.h:80:2: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ In file included from Common/CPUDetect.cpp:27: In file included from Common/Common.h:139: Common/Swap.h:78:27: error: functions that differ only in their return type cannot be overloaded inline unsigned long long bswap64(unsigned long long x) { return ((unsigned ... ^ /usr/include/sys/endian.h:61:20: note: expanded from macro 'bswap64' ^ /usr/include/x86/endian.h:80:3: note: expanded from macro '__bswap64' (__builtin_constant_p(x) ? \ ^ native/base/basictypes.h:92:44: note: previous implicit declaration is here inline uint16 swap16(uint16 _data) {return bswap16(_data);} ^ /usr/include/sys/endian.h:59:20: note: expanded from macro 'bswap16' ^ /usr/include/x86/endian.h:74:16: note: expanded from macro '__bswap16' ((__uint16_t)(__builtin_constant_p(x) ? \ ^ 8 errors generated.
This commit is contained in:
parent
05e5085f68
commit
61c106c57f
@ -71,6 +71,15 @@ inline unsigned long long bswap64(unsigned long long x) { return __loaddoublewor
|
||||
inline unsigned int bswap32(unsigned int x) { return __loadwordbytereverse(0, &x); }
|
||||
inline unsigned short bswap16(unsigned short x) { return __loadshortbytereverse(0, &x); }
|
||||
#endif
|
||||
#elif defined(__DragonFly__) || defined(__FreeBSD__) || \
|
||||
defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/endian.h>
|
||||
# ifdef __OpenBSD__
|
||||
#define bswap16 swap16
|
||||
#define bswap32 swap32
|
||||
#define bswap64 swap64
|
||||
#define
|
||||
# endif
|
||||
#else
|
||||
// TODO: speedup
|
||||
inline unsigned short bswap16(unsigned short x) { return (x << 8) | (x >> 8); }
|
||||
|
Loading…
Reference in New Issue
Block a user