Skip to content

Commit

Permalink
Fix coverity issue in BitMaskMax
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 committed Aug 26, 2024
1 parent 85a948b commit ec15ab1
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 ec15ab1

Please sign in to comment.