mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Fixed VS warnings. Issue #238
This commit is contained in:
@@ -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<!!(_x)>::value)
|
||||
#define BX_ENABLED(_x) BX_IGNORE_C4127(bx::isEnabled<!!(_x)>::value)
|
||||
|
||||
namespace bx
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ namespace bx
|
||||
template <typename Ty>
|
||||
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 <typename Ty>
|
||||
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 <typename Ty>
|
||||
inline Ty alignUp(Ty _a, int32_t _align)
|
||||
{
|
||||
const Ty mask = _align - 1;
|
||||
const Ty mask = Ty(_align - 1);
|
||||
return Ty( (_a + mask) & ~mask);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user