Skip to content

Commit ee5f2ab

Browse files
committed
Assume little-endian on Windows. Fixes <sys/param.h> not found
1 parent 73451e7 commit ee5f2ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crypto/int-util.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <stdbool.h>
99
#include <stdint.h>
1010
#include <string.h>
11-
#include <sys/param.h>
1211

1312
/*
1413
* Create GNU compatible endian macros. We use the values for __LITTLE_ENDIAN
@@ -28,6 +27,12 @@
2827
#if defined(_MSC_VER)
2928
#include <stdlib.h>
3029

30+
//instead of #include <sys/param.h>
31+
// assume little-endian on Windows
32+
#define LITTLE_ENDIAN 1234
33+
#define BIG_ENDIAN 4321
34+
#define BYTE_ORDER LITTLE_ENDIAN
35+
3136
static inline uint32_t rol32(uint32_t x, int r) {
3237
static_assert(sizeof(uint32_t) == sizeof(unsigned int), "this code assumes 32-bit integers");
3338
return _rotl(x, r);
@@ -38,6 +43,7 @@ static inline uint64_t rol64(uint64_t x, int r) {
3843
}
3944

4045
#else
46+
#include <sys/param.h>
4147

4248
static inline uint32_t rol32(uint32_t x, int r) {
4349
return (x << (r & 31)) | (x >> (-r & 31));

0 commit comments

Comments
 (0)