X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fexfat-utils.git;a=blobdiff_plain;f=libexfat%2Fplatform.h;fp=libexfat%2Fplatform.h;h=0e5dc9113ae13c05c5bfaed292cc56544d1e1adf;hp=0000000000000000000000000000000000000000;hb=f77812e8b678b8bf620bfbf33882139997ccda34;hpb=ce055aa572264a45b3749be840ff2a8f51fc4ef0 diff --git a/libexfat/platform.h b/libexfat/platform.h new file mode 100644 index 0000000..0e5dc91 --- /dev/null +++ b/libexfat/platform.h @@ -0,0 +1,63 @@ +/* + platform.h (14.05.13) + OS-specific code (libc-specific in fact). Note that systems with the + same kernel can use different libc implementations. + + Free exFAT implementation. + Copyright (C) 2010-2014 Andrew Nayenko + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef PLATFORM_H_INCLUDED +#define PLATFORM_H_INCLUDED + +#if defined(__GLIBC__) + +#include +#include +#define exfat_bswap16(x) bswap_16(x) +#define exfat_bswap32(x) bswap_32(x) +#define exfat_bswap64(x) bswap_64(x) +#define EXFAT_BYTE_ORDER __BYTE_ORDER +#define EXFAT_LITTLE_ENDIAN __LITTLE_ENDIAN +#define EXFAT_BIG_ENDIAN __BIG_ENDIAN + +#elif defined(__APPLE__) + +#include +#include +#define exfat_bswap16(x) OSSwapInt16(x) +#define exfat_bswap32(x) OSSwapInt32(x) +#define exfat_bswap64(x) OSSwapInt64(x) +#define EXFAT_BYTE_ORDER BYTE_ORDER +#define EXFAT_LITTLE_ENDIAN LITTLE_ENDIAN +#define EXFAT_BIG_ENDIAN BIG_ENDIAN + +#elif defined(__FreeBSD__) || defined(__DragonFlyBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) + +#include +#define exfat_bswap16(x) bswap16(x) +#define exfat_bswap32(x) bswap32(x) +#define exfat_bswap64(x) bswap64(x) +#define EXFAT_BYTE_ORDER _BYTE_ORDER +#define EXFAT_LITTLE_ENDIAN _LITTLE_ENDIAN +#define EXFAT_BIG_ENDIAN _BIG_ENDIAN + +#else +#error Unknown platform +#endif + +#endif /* ifndef PLATFORM_H_INCLUDED */