Changeset 1988 for trunk


Ignore:
Timestamp:
Mar 31, 2012, 1:42:44 PM (7 years ago)
Author:
ksherdy
Message:

Updated Makefile.

Location:
trunk/symbol_table/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/src/Makefile

    r1979 r1988  
    1414
    1515all: basis_bits.hpp buffer.hpp byte_pool.hpp  hash_strms.hpp  hash_table.hpp  id_group_strms.hpp  id_symbol_table.hpp  main.cpp  Makefile  marker_strms.hpp  symbol_table.hpp  transpose.hpp
    16         $(CC) -o main main.cpp $(AFLAGS) -DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG -DBUFFER_PROFILING #
     16        $(CC) -o main main.cpp $(AFLAGS) -DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG -DHASH_TABLE_HPP_DEBUG # -DBUFFER_PROFILING
    1717
    1818clean:
  • trunk/symbol_table/src/hash_table.hpp

    r1986 r1988  
    1515=============================================================================*/
    1616
    17 #define HASH_TABLE_HPP_DEBUG
     17//#define HASH_TABLE_HPP_DEBUG
    1818
    1919#define MIN(a, b) ((a < b) ? a : b)
    2020#define MAX(a, b) ((a > b) ? a : b)
    21 #define MAX_TABLE_SIZE 65536
     21#define MAX_TABLE_SIZE 65536 * 4
     22#define MAX_HASH_BITS 17    /* WARNING - Length dependent. */
    2223
    2324#include "../lib/bitblock.hpp"
     
    187188            cout << endl;
    188189        #else
    189             cout << "#define for diagnostics." << endl;
     190            cout << "#define HASH_TABLE_HPP_DEBUG for diagnostics." << endl;
    190191        #endif
     192    }
     193
     194
     195    void print_table_distribution() const {
     196
     197        for(int i=0;i<table_size;i++) {
     198
     199            node * head = table[i];
     200            node * crt = head;
     201
     202            if(head != NULL) { cout << "table[" << i << "]"; }
     203
     204            while(crt != NULL) {
     205                cout << "X";
     206                crt = crt->next;
     207            }
     208
     209            if(head != NULL) { cout << endl; }
     210        }
    191211    }
    192212
     
    218238    }
    219239
    220     void init(const uint32_t size, const uint32_t factor) {
     240    void init(const uint32_t size, const uint32_t chain_lgth) {
    221241
    222242        hash_size = MIN((log2msb(size)),hash_strategy.max_hashsize());
     
    228248                abort();
    229249        }
    230         resize_chain_lgth = factor;
     250        resize_chain_lgth = chain_lgth;
    231251    }
    232252
     
    255275            crt = crt->next;
    256276        }
     277
    257278        return lgth;
    258279    }
     
    267288            return true;
    268289        }
     290
    269291        return false;
    270292    }
     
    397419};
    398420
     421template<> class hash_strategy_t<9>: public hash_strategy {
     422public:
     423    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) {
     424        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     425    };
     426    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 9; }
     427};
     428
     429template<> class hash_strategy_t<10>: public hash_strategy {
     430public:
     431    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) {
     432        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     433    };
     434    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 10; }
     435};
     436
     437template<> class hash_strategy_t<11>: public hash_strategy {
     438public:
     439    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) {
     440        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     441    };
     442    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 11; }
     443};
     444
     445template<> class hash_strategy_t<12>: public hash_strategy {
     446public:
     447    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) {
     448        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     449    };
     450    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 12; }
     451};
     452
     453template<> class hash_strategy_t<13>: public hash_strategy {
     454public:
     455    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) {
     456        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     457    };
     458    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 13; }
     459};
     460
     461template<> class hash_strategy_t<14>: public hash_strategy {
     462public:
     463    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) {
     464        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     465    };
     466    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 14; }
     467};
     468
     469template<> class hash_strategy_t<15>: public hash_strategy {
     470public:
     471    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) {
     472        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     473    };
     474    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 15; }
     475};
     476
     477template<> class hash_strategy_t<16>: public hash_strategy {
     478public:
     479    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) {
     480        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits);
     481    };
     482    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 16; }
     483};
     484
    399485/* Default */
    400486class hash_strategy_d: public hash_strategy {
     
    403489        return bit_compress_hash(h0, h1, idx, slice_bits, hash_bits); // expect h0 as hash bit stream
    404490    }
    405     /* WARNING: Min bit count of any default (non-specialized) bit_compress_hash. */
    406     static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 17; }
     491    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return MAX_HASH_BITS; }
    407492};
    408493
  • trunk/symbol_table/src/id_symbol_table.hpp

    r1986 r1988  
    1616//#define ID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG
    1717#ifdef ID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG
    18 static void print_symbol_debug(const uint8_t buffer [], const uint32_t spos, const uint32_t epos, const uint32_t lgth) {
     18static void print_symbol_debug(const uint8_t buffer [], const int32_t spos, const uint32_t epos, const uint32_t lgth) {
    1919    cout << "Symbol(";
    2020    cout << "Lgth:" << lgth;
     
    3737class id_symbol_table:public symbol_table {
    3838public:
    39     id_symbol_table():hash_table_1(256),hash_table_5(4096),hash_table_gte_17(65536){}
     39    id_symbol_table():hash_table_1(256){}
    4040    ~id_symbol_table() {
    4141#ifdef ID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG
    42         hash_table_1.print_table();
    43         hash_table_2.print_table();
    44         hash_table_3.print_table();
    45         hash_table_4.print_table();
    46         hash_table_5.print_table();
    47         hash_table_6.print_table();
    48         hash_table_7.print_table();
    49         hash_table_8.print_table();
    50         hash_table_9.print_table();
    51         hash_table_10.print_table();
    52         hash_table_11.print_table();
    53         hash_table_12.print_table();
    54         hash_table_13.print_table();
    55         hash_table_14.print_table();
    56         hash_table_15.print_table();
    57         hash_table_16.print_table();
     42//      hash_table_1.print_table();
     43//      hash_table_2.print_table();
     44//      hash_table_3.print_table();
     45//      hash_table_4.print_table();
     46//      hash_table_5.print_table();
     47//      hash_table_6.print_table();
     48//      hash_table_7.print_table();
     49//      hash_table_8.print_table();
     50//      hash_table_9.print_table();
     51//      hash_table_10.print_table();
     52//      hash_table_11.print_table();
     53//      hash_table_12.print_table();
     54//      hash_table_13.print_table();
     55//      hash_table_14.print_table();
     56//      hash_table_15.print_table();
     57//      hash_table_16.print_table();
    5858        hash_table_gte_17.print_table();
    5959        hash_table_1.print_diagnostics();
     
    7575        hash_table_gte_17.print_diagnostics();
    7676#endif
     77
    7778    }
    7879
Note: See TracChangeset for help on using the changeset viewer.