Static Public Member Functions |
static void | generate_first_pos_of_excess_val () |
static void | generate_last_pos_of_excess_val () |
static void | generate_very_near_find_open () |
static void | generate_very_near_enclose () |
static uint64_t | b1Cnt (uint64_t x) |
| Counts the number of 1-bits in the 64bit integer x.
|
static uint32_t | b1Cnt32 (uint32_t x) |
| Counts the number of 1-bits in the 32bit integer x.
|
static uint32_t | b1CntNaive (uint64_t x) |
| Naive implementation of the b1Cnt function.
|
static uint32_t | b11Cnt (uint64_t x, uint64_t &c) |
| Count the number of consecutive and distinct 11 in the 64bit integer x.
|
static uint32_t | b11CntS (uint64_t x, uint64_t &c) |
static uint32_t | b11CntS (uint64_t x) |
static uint32_t | b11Cnt (uint64_t x) |
| Count the number of consecutive and distinct 11 in the 64bit integer x.
|
static uint32_t | b11CntNaive (uint64_t x) |
| Naive implementation of the b11Cnt function.
|
static uint32_t | eB11Cnt (uint64_t x) |
| Count 11 bit pairs starting at even positions in the 64bit integer x.
|
static uint32_t | b10Cnt (uint64_t x, uint64_t &c) |
| Count 10 bit pairs in the word x.
|
static uint32_t | b01Cnt (uint64_t x, uint64_t &c) |
| Count 01 bit pairs in the word x.
|
static uint32_t | b10CntNaive (uint64_t x, uint64_t &c) |
static uint64_t | b10Map (uint64_t x, uint64_t c=0) |
| Map all 10 bit pairs to 01 or 1 if c=1 and the lsb=0. All other pairs are mapped to 00.
|
static uint64_t | b01Map (uint64_t x, uint64_t c=1) |
| Map all 01 bit pairs to 01 of 1 if c=1 and the lsb=0. All other pairs are mapped to 00.
|
static uint32_t | i1BP (uint64_t x, uint32_t i) |
| Calculate the position of the i-th rightmost 1 bit in the 64bit integer x.
|
static uint32_t | i1BP2 (uint64_t x, uint32_t i) |
static uint32_t | j1BP (uint64_t x, uint32_t j) |
| i1BP implementation proposed by Vigna.
|
static uint32_t | k1BP (uint64_t x, uint32_t j) |
| i1BP implementation using SSE4.2.
|
static uint32_t | i1BPNaive (uint64_t x, uint32_t i) |
| Naive implementation of i1BP.
|
static uint32_t | l1BP (uint64_t x) |
| Calculates the position of the leftmost 1-bit in the 64bit integer x if it exists.
|
static uint32_t | l1BPNaive (uint64_t x) |
| Naive implementation of l1BP.
|
static uint32_t | r1BP (uint64_t x) |
| Calculates the position of the rightmost 1-bit in the 64bit integer x if it exists.
|
static uint32_t | r1BPNaive (uint64_t x) |
| Naive implementation of r1BP.
|
static uint32_t | i11BP (uint64_t x, uint32_t i, uint32_t c=0) |
| Calcluates the position of the i-th rightmost 11-bit-pattern which terminates a fibonacci coded integer in x.
|
static uint32_t | i11BPNaive (uint64_t x, uint32_t i) |
| Naive implementation of i11BP.
|
static uint64_t | all11BPs (uint64_t x, bool &c) |
static uint32_t | eI11BP (uint64_t x, uint32_t i) |
| Calculates the position of the i-th rightmost 11-bit-pattern which terminates a Ternary coded integer in x.
|
static uint32_t | l11BP (uint64_t x) |
| Calculates the position of the leftmost 11-bit-pattern which terminates a fibonacci coded integer in x.
|
static void | write_int (uint64_t *word, uint64_t x, const uint8_t offset=0, const uint8_t len=64) |
| TODO: Documentation for this function.
|
static void | write_int_and_move (uint64_t *&word, uint64_t x, uint8_t &offset, const uint8_t len) |
| TODO: Documentation for this function.
|
static uint64_t | read_int (const uint64_t *word, uint8_t offset=0, const uint8_t len=64) |
| TODO: Documentation for this function.
|
static uint64_t | read_int_and_move (const uint64_t *&word, uint8_t &offset, const uint8_t len=64) |
| TODO: Documentation for this function.
|
static uint64_t | readUnaryInt (const uint64_t *word, uint8_t offset=0) |
| TODO: Documentation for this function.
|
static uint64_t | readUnaryIntAndMove (const uint64_t *&word, uint8_t &offset) |
| TODO: Documentation for this function.
|
static void | move_right (const uint64_t *&word, uint8_t &offset, const uint8_t len) |
| Move the bit pointer consisting of a uint64_t pointer and an offset len positions to the right.
|
static void | move_left (const uint64_t *&word, uint8_t &offset, const uint8_t len) |
| Move the bit pointer consisting of a uint64_t pointer and an offset len positions to the left.
|
static uint64_t | next (const uint64_t *word, uint64_t idx) |
| Get the first one bit in the intervall .
|
static uint64_t | prev (const uint64_t *word, uint64_t idx) |
| Get the one bit with the greatest position in the intervall .
|
static uint16_t | max_excess (uint64_t x, uint16_t &b1Cnt) |
static uint16_t | max_excess2 (uint64_t x, uint16_t &b1Cnt) |
static uint16_t | max_excess3 (uint64_t x, uint16_t &b1Cnt) |
static void | max_byte_excesses (uint64_t w, uint64_t &max_byte_excesses, uint64_t &byte_prefix_sums_x_2) |
static void | max_byte_excesses2 (uint64_t w, uint64_t &max_byte_excesses, uint64_t &byte_prefix_sums_x_2) |
static void | min_max_byte_excesses (uint64_t max2, uint64_t &min_byte_excesses, uint64_t &max_byte_excesses, uint64_t &byte_prefix_sums_x_2) |
static uint8_t | first_excess_position (uint64_t w, uint8_t excess_val, uint64_t &byte_prefix_sums_x_2) |
static uint8_t | first_excess_position_naive (uint64_t w, uint8_t excess_val, uint64_t &byte_prefix_sums_x_2) |
static uint8_t | last_excess_position (uint64_t w, uint8_t excess_val, uint64_t &byte_prefix_sums_x_2) |
static uint8_t | last_excess_position_naive (uint64_t w, uint8_t excess_val, uint64_t &byte_prefix_sums_x_2) |
static uint8_t | find_open (uint64_t w, uint8_t close_parenthesis_index) |
static uint8_t | find_open_naive (uint64_t w, uint8_t close_parenthesis_index) |
static uint8_t | find_enclose (uint64_t w, uint8_t open_parenthesis_index) |
static uint8_t | find_enclose_naive (uint64_t w, uint8_t open_parenthesis_index) |
Static Public Attributes |
static const int64_t | All1Mask = -1LL |
| 64bit mask with all bits set to 1.
|
static const uint64_t | DeBruijn64 = 0x0218A392CD3D5DBFULL |
| This constant represents a de Bruijn sequence B(k,n) for k=2 and n=6.
|
static const uint32_t | DeBruijn64ToIndex [64] |
| This table maps a 6-bit subsequence S[idx...idx+5] of constant DeBruijn64 to idx.
|
static const uint64_t | Fib [92] |
| Array containing fibonacci numbers less than .
|
static const uint8_t | B1CntBytes [256] |
| Array containing the popcnts for all 2^8 possible byte values.
|
static const uint32_t | L1BP [256] |
| Array containing precomputed values for the leftmost 1-bit in a 8bit integer.
|
static const uint64_t | Li1Mask [65] |
| An array with entry i containing a 64bit integer with the last i bits set.
|
static const uint64_t | Li0Mask [65] |
| An array with entry i containing a 64bit integer with the last i bits not set.
|
static const uint8_t | lookupr1BP [256] |
static const uint8_t | Select256 [256 *8] |
| An array with precomputed select queries on a 8-bit integer.
|
static const uint64_t | PsOverflow [65] |
static const uint32_t | powerOf3 [9] |
static const uint8_t | max_excess_8bit [256] |
static const uint64_t | _8_x_the_byte [65] |
| Contains 64 bit constants. Constant i is equal to 8 bytes each set to i.
|
static const uint8_t | cover0 [1] |
static const uint8_t | cover1 [2] |
static const uint8_t | cover2 [3] |
static const uint8_t | cover3 [4] |
static const uint8_t | cover4 [5] |
static const uint8_t | cover5 [7] |
static const uint8_t | cover6 [9] |
static const uint8_t | cover7 [13] |
static const uint8_t | cover8 [20] |
static const uint8_t * | covers [9] |
static const uint32_t | cover_sizes [9] |
static const uint8_t | first_pos_of_excess_val [256 *9] |
static const uint8_t | last_pos_of_excess_val [256 *17] |
static const uint8_t | very_near_find_open [256] |
| Precomputed answers for find_open for blocks of 8 bit preceding the closing parenthesis.
|
static const uint8_t | very_near_enclose [256] |
A helper class for bitwise tricks on 64 bit words.
bit_magic is a helper class for bitwise tricks and techniques. For the basic tricks and techiques we refer to Donald E. Knuth's "The Art of Computer Programming", Volume 4A, Chapter 7.1.3 and the informative website of Sean E. Anderson about the topic: http://www-graphics.stanford.edu/~seander/bithacks.html .
We have added new functions like: b11Cnt and i11BP.
All members of this class are static variables or methods. This class cannot be instantiated.
- Author:
- Simon Gog