SanitizerMask::bitPosToMask - fix operator precedence warnings. NFCI.

Fix static analyzer operator precedence warnings with suitable bracketing. Pull out the mask generation code so clang-format doesn't make such a mess of it.
This commit is contained in:
Simon Pilgrim 2019-11-04 15:07:37 +00:00
parent 03cde3a7cc
commit a0324e9113
1 changed files with 5 additions and 4 deletions

View File

@ -52,10 +52,11 @@ public:
/// Create a mask with a bit enabled at position Pos.
static constexpr SanitizerMask bitPosToMask(const unsigned Pos) {
return SanitizerMask((Pos < kNumBitElem) ? 1ULL << Pos % kNumBitElem : 0,
(Pos >= kNumBitElem && Pos < kNumBitElem * 2)
? 1ULL << Pos % kNumBitElem
: 0);
uint64_t mask1 = (Pos < kNumBitElem) ? 1ULL << (Pos % kNumBitElem) : 0;
uint64_t mask2 = (Pos >= kNumBitElem && Pos < (kNumBitElem * 2))
? 1ULL << (Pos % kNumBitElem)
: 0;
return SanitizerMask(mask1, mask2);
}
unsigned countPopulation() const {