mirror of
https://github.com/love2d/love-android.git
synced 2026-08-19 20:20:25 +02:00
using latest love-android @ changeset 8659be0e75a3
This commit is contained in:
@@ -21,6 +21,15 @@
|
||||
#ifndef LOVE_INT_H
|
||||
#define LOVE_INT_H
|
||||
|
||||
// fixes compile errors of the form:
|
||||
// "error: expected unqualified-id before '__extension__'"
|
||||
#ifdef LOVE_ANDROID
|
||||
#include <sys/endian.h>
|
||||
#undef swap16
|
||||
#undef swap32
|
||||
#undef swap64
|
||||
#endif
|
||||
|
||||
// C standard sized integer types.
|
||||
// This header was added to Visual studio in VS 2012, which is LOVE's current
|
||||
// minimum supported VS version (as of this comment's commit date.)
|
||||
@@ -47,6 +56,27 @@ typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
static inline uint16 swap16(uint16 x)
|
||||
{
|
||||
return (x >> 8) | (x << 8);
|
||||
}
|
||||
|
||||
static inline uint32 swap32(uint32 x)
|
||||
{
|
||||
return ((x & 0x000000FF) << 24) |
|
||||
((x & 0x0000FF00) << 8) |
|
||||
((x & 0x00FF0000) >> 8) |
|
||||
((x & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
static inline uint64 swap64(uint64 x)
|
||||
{
|
||||
return ((x << 56) & 0xFF00000000000000ULL) | ((x << 40) & 0x00FF000000000000ULL) |
|
||||
((x << 24) & 0x0000FF0000000000ULL) | ((x << 8) & 0x000000FF00000000ULL) |
|
||||
((x >> 8) & 0x00000000FF000000ULL) | ((x >> 24) & 0x0000000000FF0000ULL) |
|
||||
((x >> 40) & 0x000000000000FF00ULL) | ((x >> 56) & 0x00000000000000FFULL);
|
||||
}
|
||||
|
||||
} // love
|
||||
|
||||
#endif // LOVE_INT_H
|
||||
|
||||
Reference in New Issue
Block a user