File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111#pragma once
1212
13- #include <endian.h>
1413#include <errno.h>
1514#include <string.h>
1615
16+ #ifdef __linux__
17+ #include <endian.h>
18+ #else
19+ #if defined(__BYTE_ORDER__ ) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
20+ #define htobe16 (x ) (x)
21+ #define htobe32 (x ) (x)
22+ #define htobe64 (x ) (x)
23+ #define htole16 (x ) __builtin_bswap16(x)
24+ #define htole32 (x ) __builtin_bswap32(x)
25+ #define htole64 (x ) __builtin_bswap64(x)
26+ #define le16toh (x ) __builtin_bswap16(x)
27+ #define le32toh (x ) __builtin_bswap32(x)
28+ #define le64toh (x ) __builtin_bswap64(x)
29+ #else
30+ /* Little-endian (most common case for Windows) */
31+ #define htobe16 (x ) __builtin_bswap16(x)
32+ #define htobe32 (x ) __builtin_bswap32(x)
33+ #define htobe64 (x ) __builtin_bswap64(x)
34+ #define htole16 (x ) (x)
35+ #define htole32 (x ) (x)
36+ #define htole64 (x ) (x)
37+ #define le16toh (x ) (x)
38+ #define le32toh (x ) (x)
39+ #define le64toh (x ) (x)
40+ #endif
41+ #endif
42+
1743#include <nvme/ioctl.h>
1844#include <nvme/types.h>
1945
You can’t perform that action at this time.
0 commit comments