diff --git a/include/bx/bx.h b/include/bx/bx.h index 7ad7322..9267bbd 100644 --- a/include/bx/bx.h +++ b/include/bx/bx.h @@ -20,10 +20,14 @@ #define BX_COUNTOF(_x) sizeof(bx::CountOfRequireArrayArgumentT(_x) ) /// -#define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) ) +#if BX_COMPILER_MSVC +# define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) ) +#else +# define BX_IGNORE_C4127(_x) (!!(_x) ) +#endif // BX_COMPILER_MSVC /// -#define BX_ENABLED(_x) (bx::isEnabled::value) +#define BX_ENABLED(_x) BX_IGNORE_C4127(bx::isEnabled::value) namespace bx { diff --git a/include/bx/inline/allocator.inl b/include/bx/inline/allocator.inl index 1810f0d..830fdb8 100644 --- a/include/bx/inline/allocator.inl +++ b/include/bx/inline/allocator.inl @@ -27,7 +27,7 @@ namespace bx union { void* ptr; uintptr_t addr; } un; un.ptr = _ptr; uintptr_t unaligned = un.addr + _extra; // space for header - uintptr_t aligned = bx::alignUp(unaligned, _align); + uintptr_t aligned = bx::alignUp(unaligned, int32_t(_align) ); un.addr = aligned; return un.ptr; } diff --git a/include/bx/inline/uint32_t.inl b/include/bx/inline/uint32_t.inl index e7227d1..cced114 100644 --- a/include/bx/inline/uint32_t.inl +++ b/include/bx/inline/uint32_t.inl @@ -690,7 +690,7 @@ namespace bx template inline bool isAligned(Ty _a, int32_t _align) { - const Ty mask = _align - 1; + const Ty mask = Ty(_align - 1); return 0 == (_a & mask); } @@ -710,7 +710,7 @@ namespace bx template inline Ty alignDown(Ty _a, int32_t _align) { - const Ty mask = _align - 1; + const Ty mask = Ty(_align - 1); return Ty(_a & ~mask); } @@ -733,7 +733,7 @@ namespace bx template inline Ty alignUp(Ty _a, int32_t _align) { - const Ty mask = _align - 1; + const Ty mask = Ty(_align - 1); return Ty( (_a + mask) & ~mask); }