source: proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.cpp @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 665 bytes
Line 
1#include "bitindex.h"
2
3// Definitions of static members of BitIndex.
4
5int BitIndex::index32[32];
6unsigned long BitIndex::on[32];
7unsigned long BitIndex::off[32];
8unsigned long BitIndex::lgtable[16];
9
10// Implementations.
11
12BitIndex::BitIndex (void)
13{
14  setup();
15}
16
17
18void BitIndex::setup (void)
19{
20  int t[] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3};
21  int i;
22  for (i = 0; i < 32; i++) {
23    index32[ (debruijn32 << i) >> 27 ] = i;
24  }
25  for (i = 0; i < 16; i++) {
26    lgtable[i] = t[i];
27  }
28  for (i = 0; i < 32; i++) {
29    on[i] = 1 << i;
30    off[i] = ~on[i];
31  }
32}
33
34
35
36// One instance of BitIndex so everything will work.
37
38static BitIndex _hiddenBitIndex;
Note: See TracBrowser for help on using the repository browser.