Skip to content

Commit 2da81fa

Browse files
committed
mpconfig.h: Add basic support for target endianness configuration.
A specific target can define either MP_ENDIANNESS_LITTLE or MP_ENDIANNESS_BIG to 1. Default is MP_ENDIANNESS_LITTLE. TODO: Autodetect based on compiler predefined macros?
1 parent 6582d64 commit 2da81fa

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

py/mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ typedef double mp_float_t;
169169
// machine_int_t value with most significant bit set
170170
#define WORD_MSBIT_HIGH (((machine_uint_t)1) << (BYTES_PER_WORD * 8 - 1))
171171

172+
#if !defined(MP_ENDIANNESS_LITTLE) && !defined(MP_ENDIANNESS_BIG)
173+
// Just because most archs are such?
174+
#define MP_ENDIANNESS_LITTLE (1)
175+
#endif
176+
172177
// printf format spec to use for machine_int_t and friends
173178
#ifndef INT_FMT
174179
#ifdef __LP64__

0 commit comments

Comments
 (0)