Changeset 2053 for trunk


Ignore:
Timestamp:
Apr 26, 2012, 10:50:55 PM (7 years ago)
Author:
ksherdy
Message:

Specialized on LGTH.

Location:
trunk/symbol_table
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/main_template.cpp

    r2052 r2053  
    3232#include "transpose.hpp"
    3333#include "buffer.hpp"
    34 #include "gid.hpp"
    3534#include "../lib/bitblock.hpp"
    3635#include "../lib/allocator.hpp"
  • trunk/symbol_table/src/hash_table.hpp

    r2052 r2053  
    2020#define MAX(a, b) ((a > b) ? a : b)
    2121#define MAX_TABLE_SIZE 65536
    22 #define MAX_HASH_BITS 17   
    2322
    2423#include "../lib/bitblock.hpp"
     
    2928#include "../lib/hash.hpp"
    3029#include "gid.hpp"
     30#include "compare_strategy.hpp"
     31#include "hash_strategy.hpp"
    3132#include <cmath>
    3233#include <stdint.h>
     
    4142    uint8_t * h0;
    4243    uint8_t * h1;
    43     uint32_t  hash_bit_lgth;
    4444    gid_type gid;
    4545    node * next;
    4646} node;
    4747
    48 template<class COMPARE_STRATEGY, class HASH_STRATEGY, class ALLOCATOR>
     48template<uint32_t LGTH, class ALLOCATOR>
    4949class hash_table {
    5050
     
    6565    }
    6666
    67     IDISA_ALWAYS_INLINE uint64_t get_bucket(const uint8_t * h0, const uint8_t * h1, const uint32_t idx, const uint32_t slice_bits) {
     67    IDISA_ALWAYS_INLINE uint64_t get_bucket(const uint8_t * h0, const uint8_t * h1, const uint32_t idx) {
    6868                        #ifdef HASH_TABLE_HPP_DEBUG
    6969                                        lookups++;
    7070                        #endif
    71                         return hash_strategy.hash(h0,h1,idx,slice_bits,hash_size);
    72     }
    73 
    74     IDISA_ALWAYS_INLINE void insert(const uint64_t bucket, uint8_t * raw_bytes, uint32_t raw_byte_lgth, uint8_t * h0, uint8_t * h1, uint32_t hash_bit_lgth, gid_type gid) {
     71                        return hash_strategy.hash(h0,h1,idx,this->hash_strategy.max_hashsize(),this->hash_size);
     72    }
     73
     74    IDISA_ALWAYS_INLINE void insert(const uint64_t bucket, uint8_t * raw_bytes, uint32_t raw_byte_lgth, uint8_t * h0, uint8_t * h1, gid_type gid) {
    7575
    7676        node * next = (node *) malloc(sizeof(node));
     
    8484        next->h0 = h0;
    8585        next->h1 = h1;
    86         next->hash_bit_lgth = hash_bit_lgth;
    8786        next->gid = gid;
    8887
     
    159158    uint32_t table_size;            // power of 2
    160159    uint32_t hash_size;             // maximum number of bits hashed on
    161     uint32_t resize_chain_lgth; // maximum chain length
     160    uint32_t resize_chain_lgth;     // maximum chain length
    162161
    163162    node ** table;
    164163    // uint32_t elements;
    165164    byte_pool<ALLOCATOR> raw_data_pool;
    166     COMPARE_STRATEGY compare_strategy;
    167     HASH_STRATEGY hash_strategy;
     165    compare_strategy_t<LGTH> compare_strategy;
     166    hash_strategy_t<LGTH> hash_strategy;
    168167
    169168    // ----- Diagnostics -----
     
    253252                bucket = this->get_bucket(crt->h0,
    254253                                          crt->h1,
    255                                           0,
    256                                           crt->hash_bit_lgth);
     254                                          0);
    257255                this->insert(bucket,
    258256                             crt->raw_bytes,
     
    260258                             crt->h0,
    261259                             crt->h1,
    262                                  crt->hash_bit_lgth,
    263260                             crt->gid);
    264261
     
    278275};
    279276
    280 template<class COMPARE_STRATEGY, class HASH_STRATEGY, class ALLOCATOR>
    281 class id_hash_table : public hash_table<COMPARE_STRATEGY, HASH_STRATEGY, ALLOCATOR> {
     277template<uint32_t LGTH, class ALLOCATOR>
     278class id_hash_table : public hash_table<LGTH, ALLOCATOR> {
    282279
    283280public:
    284281
    285282    IDISA_ALWAYS_INLINE gid_type lookup_or_insert(uint8_t * raw_bytes, const uint32_t idx, const uint32_t raw_byte_lgth,
    286                                                   uint8_t * h0, uint8_t * h1, const uint32_t hash_bit_lgth,
    287                                                         GIDFactory & gid_factory, GIDData & gid_data) {
    288 
    289         uint64_t bucket = this->get_bucket(h0,h1,idx,hash_bit_lgth);
     283                                                  uint8_t * h0, uint8_t * h1,
     284                                                  GIDFactory & gid_factory, GIDData & gid_data) {
     285
     286        /* lookup */ // returns gid
     287        uint64_t bucket = this->get_bucket(h0,h1,idx);
    290288
    291289        node * crt = this->table[bucket];
    292290        node * prev = crt;
    293291
    294         /* lookup */
    295292        while(NULL != crt) {
    296293            if(this->compare_strategy.compare(&raw_bytes[idx], crt->raw_bytes, raw_byte_lgth)) {
     
    304301        }
    305302
     303        gid_type gid = gid_factory.next();
     304        uint64_t x0 = bit_slice(h0, idx, 1); // get pointer to bit position, TODO opt for bit/byte variants
     305        uint64_t x1 = bit_slice(h1, idx, 1);
     306        uint8_t * data_pool_raw_bytes = this->raw_data_pool.insert(&raw_bytes[idx],raw_byte_lgth); // persist
     307
    306308        /* insert */
    307         gid_type gid = gid_factory.next();
    308 
    309         uint64_t x0 = bit_slice(h0, idx, hash_bit_lgth);
    310         uint64_t x1 = bit_slice(h1, idx, hash_bit_lgth);
    311 
    312         uint8_t * data_pool_raw_bytes = this->raw_data_pool.insert(&raw_bytes[idx],raw_byte_lgth); // persist
    313 
    314309        insert( bucket,
    315310                data_pool_raw_bytes,
    316311                raw_byte_lgth,
    317                 this->raw_data_pool.insert((uint8_t *)&x0, bits2bytes(hash_bit_lgth)),
    318                 this->raw_data_pool.insert((uint8_t *)&x1, bits2bytes(hash_bit_lgth)),
    319                 hash_bit_lgth,
     312                this->raw_data_pool.insert((uint8_t *)&x0, bits2bytes(this->hash_strategy.max_hashsize())), // TODO opt for bit/byte variants
     313                this->raw_data_pool.insert((uint8_t *)&x1, bits2bytes(this->hash_strategy.max_hashsize())),
    320314                gid);
    321315
     
    340334};
    341335
    342 /* Length specialized strategy classes. Hash, Compare */
    343 
    344 /* Templated approach: (i) avoids duplicate code, (ii) avoids vtable overhead, (iii) introduces coding complexity.*/
    345 
    346 /* Hash Strategy */
    347 class hash_strategy {
     336template<uint32_t LGTH, class ALLOCATOR>
     337class div2_hash_table : public hash_table<LGTH, ALLOCATOR> {
     338
    348339public:
    349     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits);
    350     static IDISA_ALWAYS_INLINE uint32_t max_hashsize();
    351 protected:
    352     hash_strategy() {}
     340
     341
     342
     343
    353344};
    354345
    355 /* Hash functions specialized on symbol length. */
    356 template<uint32_t LGTH>
    357 class hash_strategy_t: public hash_strategy {
     346template<uint32_t LGTH, class ALLOCATOR>
     347class log2_hash_table : public hash_table<LGTH, ALLOCATOR> {
     348
    358349public:
    359     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits);
    360     static IDISA_ALWAYS_INLINE uint32_t max_hashsize();
     350
     351
    361352};
    362353
    363 template<> class hash_strategy_t<1> {
    364 public:
    365     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    366         return h0[idx];
    367     }
    368     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(1); }
    369 };
    370 
    371 template<> class hash_strategy_t<2> {
    372 public:
    373     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    374         return bit_compress_hash(h0, h1, bytes2bits(idx), slice_bits, hash_bits);
    375     }
    376     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(2); }
    377 };
    378 
    379 template<> class hash_strategy_t<3> {
    380 public:
    381     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    382         return bit_compress_hash(h0, h1, bytes2bits(idx), slice_bits, hash_bits);
    383     }
    384     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(3); }
    385 };
    386 
    387 template<> class hash_strategy_t<4>: public hash_strategy {
    388 public:
    389     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    390         return bit_compress_hash(h0, h1, bytes2bits(idx), slice_bits, hash_bits);
    391     };
    392     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(4); }
    393 };
    394 
    395 template<> class hash_strategy_t<5>: public hash_strategy {
    396 public:
    397     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    398         return bit_compress_hash(h0, h1, bytes2bits(idx), slice_bits, hash_bits);
    399     };
    400     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(5); }
    401 };
    402 
    403 template<> class hash_strategy_t<6>: public hash_strategy {
    404 public:
    405     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    406         return bit_compress_hash(h0, h1, bytes2bits(idx), slice_bits, hash_bits);
    407     };
    408     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(6); }
    409 };
    410 
    411 template<> class hash_strategy_t<7>: public hash_strategy {
    412 public:
    413     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    414         return bit_compress_hash(h0, h1, bytes2bits(idx), slice_bits, hash_bits);
    415     };
    416     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return bytes2bits(7); }
    417 };
    418 
    419 template<> class hash_strategy_t<8>: public hash_strategy {
    420 public:
    421     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    422         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    423     };
    424     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 8; }
    425 };
    426 
    427 template<> class hash_strategy_t<9>: public hash_strategy {
    428 public:
    429     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    430         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    431     };
    432     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 9; }
    433 };
    434 
    435 template<> class hash_strategy_t<10>: public hash_strategy {
    436 public:
    437     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    438         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    439     };
    440     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 10; }
    441 };
    442 
    443 template<> class hash_strategy_t<11>: public hash_strategy {
    444 public:
    445     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    446         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    447     };
    448     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 11; }
    449 };
    450 
    451 template<> class hash_strategy_t<12>: public hash_strategy {
    452 public:
    453     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    454         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    455     };
    456     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 12; }
    457 };
    458 
    459 template<> class hash_strategy_t<13>: public hash_strategy {
    460 public:
    461     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    462         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    463     };
    464     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 13; }
    465 };
    466 
    467 template<> class hash_strategy_t<14>: public hash_strategy {
    468 public:
    469     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    470         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    471     };
    472     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 14; }
    473 };
    474 
    475 template<> class hash_strategy_t<15>: public hash_strategy {
    476 public:
    477     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    478         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    479     };
    480     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 15; }
    481 };
    482 
    483 template<> class hash_strategy_t<16>: public hash_strategy {
    484 public:
    485     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    486         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
    487     };
    488     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 16; }
    489 };
    490 
    491 /* Default */
    492 class hash_strategy_d: public hash_strategy {
    493 public:
    494     static IDISA_ALWAYS_INLINE uint64_t hash(const uint8_t * h0, const uint8_t * h1, const int32_t idx, const uint32_t slice_bits, const uint32_t hash_bits) {
    495         return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits); // expect h0 as hash bit stream
    496     }
    497     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return MAX_HASH_BITS; }
    498 };
    499 
    500 /* Compare Strategy */
    501 class compare_strategy {
    502 public:
    503     static IDISA_ALWAYS_INLINE bool compare(uint8_t * x, uint8_t * y, const uint32_t lgth=0);
    504 protected:
    505     compare_strategy() {}
    506 };
    507 
    508 /* Length specific comparison */
    509 template<uint32_t LGTH, class TYPE>
    510 class identity_strategy_t: public compare_strategy {
    511 public:
    512     static IDISA_ALWAYS_INLINE bool compare(uint8_t * x, uint8_t * y, const uint32_t lgth=0) {
    513         return overlap_compare<LGTH, TYPE>(x,y);
    514     }
    515 };
    516 
    517 /* Default */
    518 class identity_strategy_d: public compare_strategy {
    519 public:
    520     static IDISA_ALWAYS_INLINE bool compare(uint8_t * x, uint8_t * y, const uint32_t lgth=0) {
    521         return mem_compare(x,y,lgth);
    522     }
    523 };
    524354
    525355#endif // HASH_TABLE_HPP
  • trunk/symbol_table/src/symbol_table.hpp

    r2052 r2053  
    4444              BitBlock ends,
    4545              uint8_t buffer [], const uint32_t lgth,
    46               uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
     46              uint8_t h0 [], uint8_t h1 [], const uint32_t h_block_size,
    4747              SYMBOL & symbols, GIDFactory & gid_factory, GIDData & gid_data);
    4848
     
    5252              BitBlock starts [], BitBlock ends [],
    5353              uint8_t buffer [],
    54               uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
     54              uint8_t h0 [], uint8_t h1 [], const uint32_t h_block_size,
    5555              SYMBOL & symbols, GIDFactory & gid_factory, GIDData & gid_data);
    5656
     
    137137                        // Byte Space Hash
    138138                        ///////////////////////////////////////////////////////////////////////////////
    139                         #define BYTE_HASH(LGTH, TYPE) \
     139                        #define BYTE_HASH(LGTH) \
    140140                                if(bitblock::any(groups.ends_##LGTH)) { \
    141                                         do_block<SYMBOL, id_hash_table <identity_strategy_t<LGTH,TYPE>, hash_strategy_t<LGTH>, ALLOCATOR> > \
     141                                        do_block<SYMBOL, id_hash_table <LGTH, ALLOCATOR> > \
    142142                                                (blk_offset, \
    143143                                                 hash_table_##LGTH, \
    144144                                                 groups.ends_##LGTH, \
    145145                                                 buffer, LGTH, /* buffer, symbol length */ \
    146                                                  buffer, buffer, bytes2bits(LGTH), BLOCK_SIZE, /* h0, h1, hash lgth (bits), hash block size (bits) */ \
     146                                                 buffer, buffer, BLOCK_SIZE, /* h0, h1, hash block size (bits) */ \
    147147                                                 symbols, this->gid_factory, this->gid_data); \
    148148                                }
    149149
    150                         BYTE_HASH(1, uint8_t);
    151                         BYTE_HASH(2, uint16_t);
    152                         BYTE_HASH(3, uint16_t);
    153                         BYTE_HASH(4, uint32_t);
    154                         BYTE_HASH(5, uint32_t);
    155                         BYTE_HASH(6, uint32_t);
    156                         BYTE_HASH(7, uint32_t);
    157 
     150                                                BYTE_HASH(1);
     151                                                BYTE_HASH(2);
     152                                                BYTE_HASH(3);
     153                                                BYTE_HASH(4);
     154                                                BYTE_HASH(5);
     155                                                BYTE_HASH(6);
     156                                                BYTE_HASH(7);
    158157                        #undef BYTE_HASH
    159158
     
    161160                        // Bit Space Hash
    162161                        ///////////////////////////////////////////////////////////////////////////////
    163                         #define BIT_HASH(LGTH, TYPE) \
     162                        #define BIT_HASH(LGTH) \
    164163                                if(bitblock::any(groups.ends_##LGTH)) { \
    165                                         do_block<SYMBOL, id_hash_table <identity_strategy_t<LGTH,TYPE>, hash_strategy_t<LGTH>, ALLOCATOR> > \
     164                                        do_block<SYMBOL, id_hash_table <LGTH, ALLOCATOR> > \
    166165                                                (blk_offset, \
    167166                                                 hash_table_##LGTH, \
    168167                                                 groups.ends_##LGTH, \
    169168                                                 buffer, LGTH, \
    170                                                  (uint8_t *)h0, (uint8_t *)h1, LGTH, (BLOCK_SIZE / 8), \
     169                                                 (uint8_t *)h0, (uint8_t *)h1, (BLOCK_SIZE / 8), \
    171170                                                 symbols, this->gid_factory, this->gid_data); \
    172171                                }
    173172
    174                         BIT_HASH(8, uint64_t);
    175                         BIT_HASH(9, uint64_t);
    176                         BIT_HASH(10, uint64_t);
    177                         BIT_HASH(11, uint64_t);
    178                         BIT_HASH(12, uint64_t);
    179                         BIT_HASH(13, uint64_t);
    180                         BIT_HASH(14, uint64_t);
    181                         BIT_HASH(15, uint64_t);
    182                         BIT_HASH(16, BitBlock);
     173                        BIT_HASH(8);
     174                        BIT_HASH(9);
     175                        BIT_HASH(10);
     176                        BIT_HASH(11);
     177                        BIT_HASH(12);
     178                        BIT_HASH(13);
     179                        BIT_HASH(14);
     180                        BIT_HASH(15);
     181                        BIT_HASH(16);
    183182
    184183                        #undef BIT_HASH
    185184
    186185                        if(bitblock::any(groups.ends_gte_17)) {
    187                                 do_block<SYMBOL, id_hash_table<identity_strategy_d, hash_strategy_d, ALLOCATOR> >
     186                                do_block<SYMBOL, id_hash_table<0, ALLOCATOR> >
    188187                                                (blk_offset,
    189188                                                 hash_table_gte_17,
    190189                                                 starts, &groups.ends_gte_17,
    191190                                                 buffer,
    192                                                  (uint8_t *)h0, (uint8_t *)h1, 17, BLOCK_SIZE/8,
     191                                                 (uint8_t *)h0, (uint8_t *)h1, BLOCK_SIZE/8,
    193192                                                 symbols, this->gid_factory, this->gid_data);
    194193                        }
     
    206205        // Byte Space Hash
    207206        ///////////////////////////////////////////////////////////////////////////////
    208         id_hash_table<identity_strategy_t<1, uint8_t>, hash_strategy_t<1>, ALLOCATOR> hash_table_1;
    209         id_hash_table<identity_strategy_t<2, uint16_t>, hash_strategy_t<2>, ALLOCATOR> hash_table_2;
    210         id_hash_table<identity_strategy_t<3, uint16_t>, hash_strategy_t<3>, ALLOCATOR> hash_table_3;
    211         id_hash_table<identity_strategy_t<4, uint32_t>, hash_strategy_t<4>, ALLOCATOR> hash_table_4;
    212         id_hash_table<identity_strategy_t<5, uint32_t>, hash_strategy_t<5>, ALLOCATOR> hash_table_5;
    213         id_hash_table<identity_strategy_t<6, uint32_t>, hash_strategy_t<6>, ALLOCATOR> hash_table_6;
    214         id_hash_table<identity_strategy_t<7, uint32_t>, hash_strategy_t<7>, ALLOCATOR> hash_table_7;
     207        id_hash_table<1, ALLOCATOR> hash_table_1;
     208        id_hash_table<2, ALLOCATOR> hash_table_2;
     209        id_hash_table<3, ALLOCATOR> hash_table_3;
     210        id_hash_table<4, ALLOCATOR> hash_table_4;
     211        id_hash_table<5, ALLOCATOR> hash_table_5;
     212        id_hash_table<6, ALLOCATOR> hash_table_6;
     213        id_hash_table<7, ALLOCATOR> hash_table_7;
    215214//      ///////////////////////////////////////////////////////////////////////////////
    216215//      // Bit Space Hash
    217216//      ///////////////////////////////////////////////////////////////////////////////
    218         id_hash_table<identity_strategy_t<8, uint64_t>, hash_strategy_t<8>, ALLOCATOR> hash_table_8;
    219         id_hash_table<identity_strategy_t<9, uint64_t>, hash_strategy_t<9>, ALLOCATOR> hash_table_9;
    220         id_hash_table<identity_strategy_t<10, uint64_t>, hash_strategy_t<10>, ALLOCATOR> hash_table_10;
    221         id_hash_table<identity_strategy_t<11, uint64_t>, hash_strategy_t<11>, ALLOCATOR> hash_table_11;
    222         id_hash_table<identity_strategy_t<12, uint64_t>, hash_strategy_t<12>, ALLOCATOR> hash_table_12;
    223         id_hash_table<identity_strategy_t<13, uint64_t>, hash_strategy_t<13>, ALLOCATOR> hash_table_13;
    224         id_hash_table<identity_strategy_t<14, uint64_t>, hash_strategy_t<14>, ALLOCATOR> hash_table_14;
    225         id_hash_table<identity_strategy_t<15, uint64_t>, hash_strategy_t<15>, ALLOCATOR> hash_table_15;
    226         id_hash_table<identity_strategy_t<16, BitBlock>, hash_strategy_t<16>, ALLOCATOR> hash_table_16;
    227         id_hash_table<identity_strategy_d, hash_strategy_d, ALLOCATOR> hash_table_gte_17;
     217        id_hash_table<8, ALLOCATOR> hash_table_8;
     218        id_hash_table<9, ALLOCATOR> hash_table_9;
     219        id_hash_table<10, ALLOCATOR> hash_table_10;
     220        id_hash_table<11, ALLOCATOR> hash_table_11;
     221        id_hash_table<12, ALLOCATOR> hash_table_12;
     222        id_hash_table<13, ALLOCATOR> hash_table_13;
     223        id_hash_table<14, ALLOCATOR> hash_table_14;
     224        id_hash_table<15, ALLOCATOR> hash_table_15;
     225        id_hash_table<16, ALLOCATOR> hash_table_16;
     226        id_hash_table<0, ALLOCATOR> hash_table_gte_17;
    228227};
    229228
     
    236235                  BitBlock ends,
    237236                  uint8_t buffer [], const uint32_t lgth,
    238                   uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
     237                  uint8_t h0 [], uint8_t h1 [], const uint32_t h_block_size,
    239238                  SYMBOL & symbols, GIDFactory & gid_factory, GIDData & gid_data) {
    240239
     
    267266                        assert (spos >= 0);
    268267
    269                         gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, h_lgth, gid_factory, gid_data); // WARNING: spos must be >= 0
     268                        gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, gid_factory, gid_data); // WARNING: spos must be >= 0
    270269
    271270                        #ifdef ID_SYMBOL_STORE_SYMBOL_GIDS_AT_END_POSITION
     
    292291                          BitBlock starts [], BitBlock ends [],
    293292                          uint8_t buffer [],
    294                           uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
     293                          uint8_t h0 [], uint8_t h1 [], const uint32_t h_block_size,
    295294                          SYMBOL & symbols, GIDFactory & gid_factory, GIDData & gid_data) {
    296295
     
    343342                }
    344343
    345                 gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, h_lgth, gid_factory, gid_data); // WARNING: spos must be >= 0
     344                gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, gid_factory, gid_data); // WARNING: spos must be >= 0
    346345
    347346                #ifdef ID_SYMBOL_STORE_SYMBOL_GIDS_AT_END_POSITION
     
    363362#endif // ID_SYMBOL_TABLE_TEMPLATE_HPP
    364363
    365 //
    366 /*
     364
     365/* // Forward Scan
    367366void do_block(uint32_t blk_offset,
    368367                  HASH_TABLE & h_table,
  • trunk/symbol_table/symbol_table.pro

    r2052 r2053  
    7676    lib/byte_compare.hpp \
    7777    lib/allocator.hpp \
    78     src/symbol_table.hpp
     78    src/symbol_table.hpp \
     79    src/compare_strategy.hpp \
     80    src/hash_strategy.hpp
Note: See TracChangeset for help on using the changeset viewer.