Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ util/

or-tools/src/util/bitset.h File Reference

#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/integral_types.h"
#include "base/logging.h"

Go to the source code of this file.

Namespaces

namespace  operations_research

Defines

#define USE_DEBRUIJN   true
 Returns the least significant bit position in n.
#define USE_ASM_LEAST_SIGNIFICANT_BIT   true
 if true, use assembly lsb

Functions

uint64 operations_research::OneBit64 (int pos)
 Returns a word with only bit pos set.
uint32 operations_research::OneBit32 (int pos)
uint64 operations_research::BitCount64 (uint64 n)
 Returns the number of bits set in n.
uint32 operations_research::BitCount32 (uint32 n)
uint64 operations_research::LeastSignificantBitWord64 (uint64 n)
 Returns a word with only the least significant bit of n set.
uint32 operations_research::LeastSignificantBitWord32 (uint32 n)
int operations_research::LeastSignificantBitPosition64 (uint64 n)
int operations_research::LeastSignificantBitPosition32 (uint32 n)
int operations_research::MostSignificantBitPosition64 (uint64 n)
 Returns the most significant bit position in n.
int operations_research::MostSignificantBitPosition32 (uint32 n)
uint64 operations_research::OneRange64 (uint64 s, uint64 e)
 Returns a word with bits from s to e set.
uint32 operations_research::OneRange32 (uint32 s, uint32 e)
uint64 operations_research::IntervalUp64 (uint64 s)
 Returns a word with s least significant bits unset.
uint32 operations_research::IntervalUp32 (uint32 s)
uint64 operations_research::IntervalDown64 (uint64 s)
 Returns a word with the s most significant bits unset.
uint32 operations_research::IntervalDown32 (uint32 s)
uint64 operations_research::BitPos64 (uint64 pos)
 Bitset operators Bitset: array of uint32/uint64 words.
uint32 operations_research::BitPos32 (uint32 pos)
uint64 operations_research::BitOffset64 (uint64 pos)
 Returns the word number corresponding to bit number pos.
uint32 operations_research::BitOffset32 (uint32 pos)
uint64 operations_research::BitLength64 (uint64 size)
 Returns the number of words needed to store size bits.
uint32 operations_research::BitLength32 (uint32 size)
uint64 operations_research::BitShift64 (uint64 v)
 Returns the bit number in the bitset of the first bit of word number v.
uint32 operations_research::BitShift32 (uint32 v)
bool operations_research::IsBitSet64 (const uint64 *const bitset, uint64 pos)
 Returns true if the bit pos is set in bitset.
bool operations_research::IsBitSet32 (const uint32 *const bitset, uint32 pos)
void operations_research::SetBit64 (uint64 *const bitset, uint64 pos)
 Sets the bit pos to true in bitset.
void operations_research::SetBit32 (uint32 *const bitset, uint32 pos)
void operations_research::ClearBit64 (uint64 *const bitset, uint64 pos)
 Sets the bit pos to false in bitset.
void operations_research::ClearBit32 (uint32 *const bitset, uint32 pos)
uint64 operations_research::BitCountRange64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns the number of bits set in bitset between positions start and end.
uint32 operations_research::BitCountRange32 (const uint32 *const bitset, uint32 start, uint32 end)
bool operations_research::IsEmptyRange64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns true if no bits are set in bitset between start and end.
bool operations_research::IsEmptyRange32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 operations_research::LeastSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns the first bit set in bitset between start and max_bit.
int operations_research::LeastSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 operations_research::MostSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns the last bit set in bitset between min_bit and start.
int operations_research::MostSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 operations_research::UnsafeLeastSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
 Unsafe versions of the functions above where respectively end and start are supposed to be set.
int32 operations_research::UnsafeLeastSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 operations_research::UnsafeMostSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
int32 operations_research::UnsafeMostSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)

Variables

static const uint64 operations_research::kAllBits64 = GG_ULONGLONG(0xFFFFFFFFFFFFFFFF)
 Basic bit operations.
static const uint32 operations_research::kAllBits32 = 0xFFFFFFFFU


Define Documentation

#define USE_ASM_LEAST_SIGNIFICANT_BIT   true

if true, use assembly lsb

Definition at line 75 of file bitset.h.

#define USE_DEBRUIJN   true

Returns the least significant bit position in n.

Discussions around lsb computation. bsr/bsf assembly instruction are quite slow, but still a little win on PIII. On k8, bsf is much slower than the C-equivalent! Using inline assembly code yields a 10% performance gain. Use de Bruijn hashing instead of bsf is always a win, on both P3 and K8. if true, use de Bruijn bit forward scanner

Definition at line 73 of file bitset.h.