summaryrefslogtreecommitdiff
path: root/extractor/veb_bitset.cc
blob: 4e364cc57a889804687b6a1720c561c2878821db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "veb_bitset.h"

using namespace std;

VEBBitset::VEBBitset(int size) : bitset(size) {
  min = max = -1;
}

void VEBBitset::Insert(int value) {
  bitset[value] = 1;
  if (min == -1 || value < min) {
    min = value;
  }
  if (max == - 1 || value > max) {
    max = value;
  }
}

int VEBBitset::GetSuccessor(int value) {
  int next_value = bitset.find_next(value);
  if (next_value == bitset.npos) {
    return -1;
  }
  return next_value;
}