Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions be/src/olap/skiplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ inline void SkipList<Key, Comparator>::Iterator::SeekToLast() {
template <typename Key, class Comparator>
int SkipList<Key, Comparator>::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);
Expand Down