Bug #4950 ยป scott_endian.h
1 |
#ifndef __SCOTT_ENDIAN_H__
|
---|---|
2 |
#define __SCOTT_ENDIAN_H__ 1
|
3 |
|
4 |
/** compatibility header for endian.h
|
5 |
* This is a simple compatibility shim to convert
|
6 |
* BSD/Linux endian macros to the Mac OS X equivalents.
|
7 |
* It is public domain.
|
8 |
* */
|
9 |
|
10 |
#ifndef __APPLE__
|
11 |
#warning "This header file (endian.h) is MacOS X specific.\n"
|
12 |
#endif /* __APPLE__ */ |
13 |
|
14 |
|
15 |
#include <libkern/OSByteOrder.h>
|
16 |
#include <machine/endian.h>
|
17 |
|
18 |
#define htobe16(x) OSSwapHostToBigInt16(x)
|
19 |
#define htole16(x) OSSwapHostToLittleInt16(x)
|
20 |
#define be16toh(x) OSSwapBigToHostInt16(x)
|
21 |
#define le16toh(x) OSSwapLittleToHostInt16(x)
|
22 |
|
23 |
#define htobe32(x) OSSwapHostToBigInt32(x)
|
24 |
#define htole32(x) OSSwapHostToLittleInt32(x)
|
25 |
#define be32toh(x) OSSwapBigToHostInt32(x)
|
26 |
#define le32toh(x) OSSwapLittleToHostInt32(x)
|
27 |
|
28 |
#define htobe64(x) OSSwapHostToBigInt64(x)
|
29 |
#define htole64(x) OSSwapHostToLittleInt64(x)
|
30 |
#define be64toh(x) OSSwapBigToHostInt64(x)
|
31 |
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
32 |
|
33 |
|
34 |
#endif /* __SCOTT_ENDIAN_H__ */ |