Skip to content

Commit d13f845

Browse files
fabianfettzaneenders
authored andcommitted
[Windows] Windows has endianess too (#3317)
TIL there is an `endian.h` on Linux and macOS that is imported through `<sys/types.h>` on Linux and Apple platforms. Apparently such a header file does not exist in Windows land. For this reason we need to define the macros that we need here ourselves.
1 parent 8a0fa7e commit d13f845

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sources/CNIOSHA1/c_nio_sha1.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@
5656
#include <sys/endian.h>
5757
#elif defined(__linux__) || defined(__APPLE__) || defined(__wasm32__)
5858
#include <sys/types.h>
59+
#elif defined(_WIN32) || defined(_WIN64)
60+
#ifndef LITTLE_ENDIAN
61+
#define LITTLE_ENDIAN 1234
62+
#endif
63+
#ifndef BIG_ENDIAN
64+
#define BIG_ENDIAN 4321
65+
#endif
66+
#ifndef BYTE_ORDER
67+
#define BYTE_ORDER LITTLE_ENDIAN
68+
#endif
5969
#endif
6070

6171

0 commit comments

Comments
 (0)