Changeset 843 for proto/parabix2/src


Ignore:
Timestamp:
Dec 18, 2010, 4:57:51 PM (9 years ago)
Author:
lindanl
Message:

Line and column couting using bitblock_bit_count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/src/LineColTracker.h

    r842 r843  
    3232    BitBlock last_block_with_newline;
    3333    BitBlock cur_newline;
     34    int newline_counts;
    3435};
     36
     37inline void LineColTracker::StoreNewlines(BitBlock newline){
     38  cur_newline = newline;
     39}
    3540
    3641LineColTracker::LineColTracker(){
    3742  blocks_after_last_newline_block = 0;
    3843  last_block_with_newline = simd_const_1(1);
     44  newline_counts = 1;
    3945}
    4046
    4147
     48#ifndef BITBLOCK_BIT_COUNT
    4249inline void LineColTracker::AdvanceBlock(){
    4350  int j = 2;
     
    7077    return lines;
    7178}
     79#endif
    7280
    7381int LineColTracker::getColNumber(int mark_pos){
     
    8088}
    8189
    82 inline void LineColTracker::StoreNewlines(BitBlock newline){
    83   cur_newline = newline;
     90#ifdef BITBLOCK_BIT_COUNT
     91inline void LineColTracker::AdvanceBlock(){
     92 
     93  if(bitblock_has_bit(cur_newline)){
     94    newline_counts += bitblock_bit_count(cur_newline);
     95    last_block_with_newline = cur_newline;
     96    blocks_after_last_newline_block = 0;
     97  }
     98  else
     99    blocks_after_last_newline_block++;
    84100}
    85101
     102int LineColTracker::getLineNumber(int mark_pos){
     103  cur_newline = simd_andc(cur_newline, sisd_sfl(simd_const_1(1),sisd_from_int(mark_pos)));
     104 
     105  if(bitblock_has_bit(cur_newline))
     106    return newline_counts + bitblock_bit_count(cur_newline);
     107  else
     108    return newline_counts;
     109}
     110#endif
    86111
     112
     113
     114
     115
Note: See TracChangeset for help on using the changeset viewer.