"Fossies" - the Fresh Open Source Software Archive

Member "dosfstools-4.2/src/endian_compat.h" (31 Jan 2021, 849 Bytes) of package /linux/misc/dosfstools-4.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "endian_compat.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 4.0_vs_4.1.

    1 #ifndef ENDIAN_COMPAT_H
    2 #define ENDIAN_COMPAT_H
    3 
    4 #if defined(HAVE_ENDIAN_H)
    5 #include <endian.h>
    6 #elif defined(HAVE_SYS_ENDIAN_H)
    7 #include <sys/endian.h>
    8 #elif defined(HAVE_LIBKERN_OSBYTEORDER_H)
    9     #include <libkern/OSByteOrder.h>
   10 
   11     #define htobe16(x) OSSwapHostToBigInt16(x)
   12     #define htole16(x) OSSwapHostToLittleInt16(x)
   13     #define be16toh(x) OSSwapBigToHostInt16(x)
   14     #define le16toh(x) OSSwapLittleToHostInt16(x)
   15 
   16     #define htobe32(x) OSSwapHostToBigInt32(x)
   17     #define htole32(x) OSSwapHostToLittleInt32(x)
   18     #define be32toh(x) OSSwapBigToHostInt32(x)
   19     #define le32toh(x) OSSwapLittleToHostInt32(x)
   20 
   21     #define htobe64(x) OSSwapHostToBigInt64(x)
   22     #define htole64(x) OSSwapHostToLittleInt64(x)
   23     #define be64toh(x) OSSwapBigToHostInt64(x)
   24     #define le64toh(x) OSSwapLittleToHostInt64(x)
   25 #else
   26 #error No endian.h available and no fallback code
   27 #endif
   28 
   29 #endif