diff --git a/be/src/olap/skiplist.h b/be/src/olap/skiplist.h index 1cd5bee71ed765..96c9d8990c38be 100644 --- a/be/src/olap/skiplist.h +++ b/be/src/olap/skiplist.h @@ -264,9 +264,9 @@ inline void SkipList::Iterator::SeekToLast() { template int SkipList::RandomHeight() { // Increase height with probability 1 in kBranching - static const unsigned int kBranching = 4; int height = 1; - while (height < kMaxHeight && ((rnd_.Next() % kBranching) == 0)) { + // "& 3" equals to "% 4", and more faster. 4 is kBranching + while (height < kMaxHeight && ((rnd_.Next() & 3) == 0)) { height++; } DCHECK(height > 0);