Ignore:
Timestamp:
May 16, 2012, 3:02:58 PM (7 years ago)
Author:
ksherdy
Message:

Added bit / byte strategy. Added length test to hash table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/src/hash_strategy.hpp

    r2092 r2106  
    22#define HASH_STRATEGY_HPP
    33
    4 #include "types.hpp"
     4#include "strategy_types.hpp"
    55
    66#define MAX_HASH_BITS 17 // Maximum length specific hash_strategy
     
    4040
    4141///////////////////////////////////////////////////////////////////////////////
     42// Identity - Default Case - Length 0 specialized for length > 16.
     43///////////////////////////////////////////////////////////////////////////////
     44template<int SCALE_FACTOR> class hash_strategy_t<7,bit_byte,SCALE_FACTOR> {
     45public:
     46    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) {
     47        return bit_compress_hash(h0, h1, idx*SCALE_FACTOR, slice_bits, hash_bits); // expect h0 as hash bit stream
     48    }
     49    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 1*SCALE_FACTOR; }
     50};
     51
     52template<int SCALE_FACTOR> class hash_strategy_t<0,bit_byte,SCALE_FACTOR> {
     53public:
     54    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) {
     55        return bit_compress_hash(h0, h1, idx*SCALE_FACTOR, slice_bits, hash_bits); // expect h0 as hash bit stream
     56    }
     57    static IDISA_ALWAYS_INLINE uint32_t max_hashsize() { return 8; }
     58};
     59
     60///////////////////////////////////////////////////////////////////////////////
    4261// Identity - Length 1 specialized.
    4362///////////////////////////////////////////////////////////////////////////////
     
    5978
    6079///////////////////////////////////////////////////////////////////////////////
    61 // Bit Space / Byte Space - div2 == id WTE bit/byte boundardy.
     80// Bit Space / Byte Space - div2 == id wit the exception of bit/byte boundardy.
    6281///////////////////////////////////////////////////////////////////////////////
    6382template<uint32_t LGTH, int SCALE_FACTOR> class hash_strategy_t<LGTH,div2,SCALE_FACTOR>: public hash_strategy_t<LGTH,id,SCALE_FACTOR>{};
Note: See TracChangeset for help on using the changeset viewer.