py/misc: Add MP_STATIC_ASSERT_NOT_MSC().

To be used in cases where the condition of the assert does not compile
under msvc.

Signed-off-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
This commit is contained in:
Yonatan Goldschmidt 2022-07-16 16:47:41 +03:00 committed by Damien George
parent cca2305211
commit 6670281472
1 changed files with 5 additions and 0 deletions

View File

@ -52,6 +52,11 @@ typedef unsigned int uint;
// Static assertion macro
#define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)]))
#if defined(_MSC_VER)
#define MP_STATIC_ASSERT_NOT_MSC(cond) (1)
#else
#define MP_STATIC_ASSERT_NOT_MSC(cond) MP_STATIC_ASSERT(cond)
#endif
// Round-up integer division
#define MP_CEIL_DIVIDE(a, b) (((a) + (b) - 1) / (b))