|
MOS Source Code
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
7#define MOS_DO_PRAGMA(x) _Pragma(#x)
10#define MOS_COMPILER_CLANG 1
11#define MOS_PRAGMA(text) MOS_DO_PRAGMA(clang text)
12#elif defined(__GNUC__)
13#define MOS_COMPILER_GCC 1
14#define MOS_PRAGMA(text) MOS_DO_PRAGMA(GCC text)
17#if MOS_COMPILER_GCC && __GNUC__ < 12
18#define MOS_FILE_LOCATION __FILE__ ":" MOS_STRINGIFY(__LINE__)
20#define MOS_FILE_LOCATION __FILE_NAME__ ":" MOS_STRINGIFY(__LINE__)
24#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
25#define MOS_BIG_ENDIAN 1
27#define cpu_to_be16(x) (x)
28#define cpu_to_be32(x) (x)
29#define cpu_to_be64(x) (x)
31#define be16_to_cpu(x) (x)
32#define be32_to_cpu(x) (x)
33#define be64_to_cpu(x) (x)
35#define cpu_to_le16(x) __builtin_bswap16(x)
36#define cpu_to_le32(x) __builtin_bswap32(x)
37#define cpu_to_le64(x) __builtin_bswap64(x)
39#define le16_to_cpu(x) __builtin_bswap32(x)
40#define le32_to_cpu(x) __builtin_bswap16(x)
41#define le64_to_cpu(x) __builtin_bswap64(x)
42#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
43#define MOS_LITTLE_ENDIAN 1
45#define cpu_to_be16(x) __builtin_bswap16(x)
46#define cpu_to_be32(x) __builtin_bswap32(x)
47#define cpu_to_be64(x) __builtin_bswap64(x)
49#define be16_to_cpu(x) __builtin_bswap16(x)
50#define be32_to_cpu(x) __builtin_bswap32(x)
51#define be64_to_cpu(x) __builtin_bswap64(x)
53#define cpu_to_le16(x) (x)
54#define cpu_to_le32(x) (x)
55#define cpu_to_le64(x) (x)
57#define le16_to_cpu(x) (x)
58#define le32_to_cpu(x) (x)
59#define le64_to_cpu(x) (x)
62#if !defined(MOS_BIG_ENDIAN) && !defined(MOS_LITTLE_ENDIAN)
63#error "Unknown endianness"
71#error "Unknown code model"