Add bracketing to macro use of parameters

This commit is contained in:
baldurk
2020-01-21 14:25:15 +00:00
parent 322e3c667d
commit 4a779e371b
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -417,8 +417,8 @@ void rdcassert(const char *msg, const char *file, unsigned int line, const char
#endif
#define RDCASSERT(...) RDCASSERTMSG("", __VA_ARGS__)
#define RDCASSERTEQUAL(a, b) RDCASSERTMSG("", a == b, a, b)
#define RDCASSERTNOTEQUAL(a, b) RDCASSERTMSG("", a != b, a, b)
#define RDCASSERTEQUAL(a, b) RDCASSERTMSG("", (a) == (b), a, b)
#define RDCASSERTNOTEQUAL(a, b) RDCASSERTMSG("", (a) != (b), a, b)
//
// Compile asserts
+2 -2
View File
@@ -494,8 +494,8 @@ TEST_CASE("Check format conversion", "[format]")
SECTION("Spot test ConvertFromR11G11B10")
{
#define R11G11B10(re, rm, ge, gm, be, bm) \
((uint32_t(re & 0x1f) << 6) | (uint32_t(ge & 0x1f) << 17) | (uint32_t(be & 0x1f) << 27) | \
uint32_t(rm & 0x3f) << 0 | uint32_t(gm & 0x3f) << 11 | uint32_t(bm & 0x1f) << 22)
((uint32_t((re)&0x1f) << 6) | (uint32_t((ge)&0x1f) << 17) | (uint32_t((be)&0x1f) << 27) | \
uint32_t((rm)&0x3f) << 0 | uint32_t((gm)&0x3f) << 11 | uint32_t((bm)&0x1f) << 22)
#define TEST11(e, m, f) \
{ \
+3 -3
View File
@@ -169,9 +169,9 @@ void PatchLineStripIndexBuffer(const DrawcallDescription *draw, uint8_t *idx8, u
{
const uint32_t restart = 0xffffffff;
#define IDX_VALUE(offs) \
(idx16 ? idx16[index + offs] \
: (idx32 ? idx32[index + offs] : (idx8 ? idx8[index + offs] : index + offs)))
#define IDX_VALUE(offs) \
(idx16 ? idx16[index + (offs)] \
: (idx32 ? idx32[index + (offs)] : (idx8 ? idx8[index + (offs)] : index + (offs))))
switch(draw->topology)
{