File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,26 @@ static SECP256K1_INLINE void *manual_alloc(void** prealloc_ptr, size_t alloc_siz
186
186
#if defined(_MSC_VER ) && defined(_WIN32 ) && !defined(SECP256K1_LITTLE_ENDIAN )
187
187
# define SECP256K1_LITTLE_ENDIAN
188
188
#endif
189
+ #if !defined(SECP256K1_LITTLE_ENDIAN ) && !defined(SECP256K1_BIG_ENDIAN )
190
+ /* Try to derive from arch/compiler-specific macros. Code taken from
191
+ https://github.com/rofl0r/endianness.h/blob/9853923246b065a3b52d2c43835f3819a62c7199/endianness.h#L52L73
192
+ */
193
+ # if defined(_X86_ ) || defined(__x86_64__ ) || defined(__i386__ ) || \
194
+ defined(__i486__ ) || defined(__i586__ ) || defined(__i686__ ) || \
195
+ defined(__MIPSEL ) || defined(_MIPSEL ) || defined(MIPSEL ) || \
196
+ defined(__ARMEL__ ) || \
197
+ (defined(__LITTLE_ENDIAN__ ) && __LITTLE_ENDIAN__ == 1 ) || \
198
+ (defined(_LITTLE_ENDIAN ) && _LITTLE_ENDIAN == 1 ) || \
199
+ defined(_M_IX86 ) || defined(_M_AMD64 ) /* MSVC */
200
+ # define SECP256K1_LITTLE_ENDIAN
201
+ # endif
202
+ # if defined(__MIPSEB ) || defined(_MIPSEB ) || defined(MIPSEB ) || \
203
+ defined(__MICROBLAZEEB__ ) || defined(__ARMEB__ ) || \
204
+ (defined(__BIG_ENDIAN__ ) && __BIG_ENDIAN__ == 1 ) || \
205
+ (defined(_BIG_ENDIAN ) && _BIG_ENDIAN == 1 )
206
+ # define SECP256K1_BIG_ENDIAN
207
+ # endif
208
+ #endif
189
209
#if defined(SECP256K1_LITTLE_ENDIAN ) == defined(SECP256K1_BIG_ENDIAN )
190
210
# error Please make sure that either SECP256K1_LITTLE_ENDIAN or SECP256K1_BIG_ENDIAN is set, see src/util.h.
191
211
#endif
You can’t perform that action at this time.
0 commit comments