py/mpconfig.h: Define BITS_PER_BYTE only if not already defined.

It's a common macro that is possibly defined in headers of systems/SDKs
MicroPython is embedded into.
This commit is contained in:
Yonatan Goldschmidt 2019-12-01 01:10:12 +02:00
parent 40057600b8
commit 1c849d63a8
1 changed files with 2 additions and 0 deletions

View File

@ -1468,7 +1468,9 @@ typedef double mp_float_t;
#define BYTES_PER_WORD (sizeof(mp_uint_t))
#endif
#ifndef BITS_PER_BYTE
#define BITS_PER_BYTE (8)
#endif
#define BITS_PER_WORD (BITS_PER_BYTE * BYTES_PER_WORD)
// mp_int_t value with most significant bit set
#define WORD_MSBIT_HIGH (((mp_uint_t)1) << (BYTES_PER_WORD * 8 - 1))