Changeset 840 for proto/parabix2/src
 Timestamp:
 Dec 18, 2010, 6:39:53 AM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

proto/parabix2/src/LineColTracker.h
r839 r840 27 27 inline void AdvanceBlock(); 28 28 inline void StoreNewlines(BitBlock newline); 29 void UpdateFromNewLineBuffer(BitBlock[] newline_strm; int blk_count); 29 30 private: 30 31 BitBlock BitParallelCounter[MAX_COUNTER_BITS]; … … 85 86 cur_newline = newline; 86 87 } 88 89 void LineColTracker::UpdateFromNewLineBuffer(BitBlock[] newline_strm; int blk_count) { 90 int i, j, k; 91 int last_blk = blk_count  1; 92 /* in case we find no newlines within the buffer, the 93 number of blocks after the last newline grows by the 94 full blk_count. */ 95 blocks_after_last_newline_block += blk_count; 96 for (i = last_blk; i >= 0; i) { 97 if (bitblock_has_bit(newline_strm[i]) { 98 last_block_with_newline = newline_strm[i]; 99 blocks_after_last_newline_block = last_blk  i; 100 break; 101 } 102 last_blk = i; /* No newlines after this block. */ 103 j = 0; 104 /* Process 7 blocks of the newline stream at a time. */ 105 while (j + 7 <= last_blk) { 106 BitBlock s1, s2, c1, c2, t0, t1, t2; 107 bitwise_full_add(newline_strm[j], newline_strm[j+1], newline_strm[j+2], s1, c1); 108 bitwise_full_add(newline_strm[j+3], newline_strm[j+4], newline_strm[j+5], s2, c2); 109 bitwise_half_add(s1, s2, newline_strm[j+6], t0, c3); /* t0 is bit0 of 7 block sum */ 110 bitwise_full_add(c1, c2, c3, t1, t2); /*t1 and t2 are bits 1 and 2 of 7 block sum. */ 111 bitwise_half_add(t0, BitParallelCounter[0], BitParallelCounter[0], carry); 112 bitwise_full_add(t1, BitParallelCounter[1], carry, BitParallelCounter[1], carry); 113 bitwise_full_add(t2, BitParallelCounter[2], carry, BitParallelCounter[2], carry); 114 bitwise_half_add(BitParallelCounter[3], carry, BitParallelCounter[3], carry); 115 k = 3; 116 while(bitblock_has_bit(carry)){ 117 k++; 118 bitwise_half_add(carry,BitParallelCounter[k],BitParallelCounter[k],carry); 119 } 120 } 121 while (j <= last_blk) { 122 bitwise_half_add(newline_strm[j], BitParallelCounter[0], BitParallelCounter[0], carry); 123 k = 0; 124 while(bitblock_has_bit(carry)){ 125 k++; 126 bitwise_half_add(carry,BitParallelCounter[k],BitParallelCounter[k],carry); 127 } 128 } 129 } 130 131
Note: See TracChangeset
for help on using the changeset viewer.