Changeset 3093


Ignore:
Timestamp:
Apr 29, 2013, 6:56:17 AM (6 years ago)
Author:
cameron
Message:

Use template type for string base; remove Bytedata dependency

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r3091 r3093  
    1919error_routine = 'raise_assert'
    2020experimentalMode=False
     21pablo_char_type = 'char'
    2122
    2223
     
    394395      return c
    395396    elif is_BuiltIn_Call(callnode,'match', 3):
    396         ast.dump(callnode)
    397397        assert isinstance(callnode.args[1], ast.Str)
    398398        string_to_match = callnode.args[1].s
    399399        match_len = len(string_to_match)
    400400        match_var = callnode.args[2]
    401         expr = mkast.call('pablo_blk_match', [callnode.args[0], callnode.args[1], match_var, ast.Num(match_len)])
     401        expr = mkast.call('pablo_blk_match<%s>' % pablo_char_type, [callnode.args[0], callnode.args[1], match_var, ast.Num(match_len)])
    402402        return expr
    403403    else:
  • trunk/lib/pabloSupport.hpp

    r3087 r3093  
    118118}
    119119
    120 IDISA_ALWAYS_INLINE BitBlock pablo_blk_match(uint8_t bytedata[], const char match_str[], BitBlock v, int len) {
     120template <typename T> IDISA_ALWAYS_INLINE BitBlock pablo_blk_match(T bytedata[], const T match_str[], BitBlock v, int len) {
    121121        union {BitBlock bitblock; ScanWord elems[sizeof(BitBlock)/sizeof(ScanWord)];} u;
    122122        u.bitblock = v;
     
    129129                        t = s;
    130130                        s = s & (s - 1); // clear rightmost bit
    131                         if (memcmp((void *) &bytedata[pos], (void *) match_str, len)) {
     131                        if (memcmp((void *) &bytedata[pos], (void *) match_str, len * sizeof(T))) {
    132132                                // Strings do not match; filter the result.
    133133                                bit = s ^ t;
  • trunk/lib/transpose.hpp

    r3088 r3093  
    4040struct Transpose {
    4141  Transpose() {}
    42   void do_block(Bytedata & bytedata, Basis_bits & basis_bits) {
     42  void do_block(char * bytedata, Basis_bits & basis_bits) {
    4343    s2p_do_block((BytePack *) bytedata, basis_bits);
    4444  }
    45   void do_final_block(Bytedata & bytedata, Basis_bits & basis_bits, BitBlock EOF_mask) {
     45  void do_final_block(char * bytedata, Basis_bits & basis_bits, BitBlock EOF_mask) {
    4646    s2p_do_final_block((BytePack *) bytedata, basis_bits, EOF_mask);
    4747  }
Note: See TracChangeset for help on using the changeset viewer.