Skip to content

Commit

Permalink
py/mpconfig.h: Define BITS_PER_BYTE only if not already defined.
Browse files Browse the repository at this point in the history
It's a common macro that is possibly defined in headers of systems/SDKs
MicroPython is embedded into.
  • Loading branch information
Jongy committed Jan 12, 2020
1 parent 4005760 commit 1c849d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions py/mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1c849d6

Please sign in to comment.