Skip to content

Commit

Permalink
Fix coverity issue in BitMaskMax (#1490)
Browse files Browse the repository at this point in the history
It should never happen but coverity do not know it.
Assert should enough here
  • Loading branch information
lplewa authored Sep 3, 2024
1 parent 6f27d0d commit bca0235
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tbbmalloc/tbbmalloc_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,13 @@ template<unsigned NUM>
class BitMaskMax : public BitMaskBasic<NUM> {
public:
void set(size_t idx, bool val) {
MALLOC_ASSERT(NUM >= idx + 1, ASSERT_TEXT);

BitMaskBasic<NUM>::set(NUM - 1 - idx, val);
}
int getMaxTrue(unsigned startIdx) const {
MALLOC_ASSERT(NUM >= startIdx + 1, ASSERT_TEXT);

int p = BitMaskBasic<NUM>::getMinTrue(NUM-startIdx-1);
return -1==p? -1 : (int)NUM - 1 - p;
}
Expand Down

0 comments on commit bca0235

Please sign in to comment.