From 06f236d37a7f96705f1fb7b8a686ddcb50f23a05 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 23 Jul 2025 18:06:18 +0200 Subject: [PATCH] [Windows] Windows has endianess too (#3317) TIL there is an `endian.h` on Linux and macOS that is imported through `` 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. --- Sources/CNIOSHA1/c_nio_sha1.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/CNIOSHA1/c_nio_sha1.c b/Sources/CNIOSHA1/c_nio_sha1.c index 2e4fa45bb..73af9a813 100644 --- a/Sources/CNIOSHA1/c_nio_sha1.c +++ b/Sources/CNIOSHA1/c_nio_sha1.c @@ -56,6 +56,16 @@ #include #elif defined(__linux__) || defined(__APPLE__) || defined(__wasm32__) #include +#elif defined(_WIN32) || defined(_WIN64) + #ifndef LITTLE_ENDIAN + #define LITTLE_ENDIAN 1234 + #endif + #ifndef BIG_ENDIAN + #define BIG_ENDIAN 4321 + #endif + #ifndef BYTE_ORDER + #define BYTE_ORDER LITTLE_ENDIAN + #endif #endif