3 OS-specific code (libc-specific in fact). Note that systems with the
4 same kernel can use different libc implementations.
6 Copyright (C) 2010-2013 Andrew Nayenko
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef PLATFORM_H_INCLUDED
23 #define PLATFORM_H_INCLUDED
25 #if defined(__GLIBC__)
29 #define exfat_bswap16(x) bswap_16(x)
30 #define exfat_bswap32(x) bswap_32(x)
31 #define exfat_bswap64(x) bswap_64(x)
32 #define EXFAT_BYTE_ORDER __BYTE_ORDER
33 #define EXFAT_LITTLE_ENDIAN __LITTLE_ENDIAN
34 #define EXFAT_BIG_ENDIAN __BIG_ENDIAN
36 #elif defined(__APPLE__)
38 #include <machine/endian.h>
39 #include <libkern/OSByteOrder.h>
40 #define exfat_bswap16(x) OSSwapInt16(x)
41 #define exfat_bswap32(x) OSSwapInt32(x)
42 #define exfat_bswap64(x) OSSwapInt64(x)
43 #define EXFAT_BYTE_ORDER BYTE_ORDER
44 #define EXFAT_LITTLE_ENDIAN LITTLE_ENDIAN
45 #define EXFAT_BIG_ENDIAN BIG_ENDIAN
47 #elif defined(__FreeBSD__) || defined(__DragonFlyBSD__) || defined(__NetBSD__)
49 #include <sys/endian.h>
50 #define exfat_bswap16(x) bswap16(x)
51 #define exfat_bswap32(x) bswap32(x)
52 #define exfat_bswap64(x) bswap64(x)
53 #define EXFAT_BYTE_ORDER _BYTE_ORDER
54 #define EXFAT_LITTLE_ENDIAN _LITTLE_ENDIAN
55 #define EXFAT_BIG_ENDIAN _BIG_ENDIAN
58 #error Unknown platform
61 #endif /* ifndef PLATFORM_H_INCLUDED */