Changeset 839
 Timestamp:
 Dec 18, 2010, 6:07:31 AM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

proto/parabix2/src/LineColTracker.h
r838 r839 1 1 /* Parallel Bitwise Tracking of Line Number/Column Number 2 Copyright (C) 2010, Dan Lin 2 Copyright (C) 2010, Dan Lin and Robert D. Cameron 3 3 Licensed to the public under the Open Software License 3.0. 4 4 Licensed to International Characters Inc. … … 7 7 8 8 #define MAX_COUNTER_BITS 24 9 static inline void half_add(BitBlock x, BitBlock y, BitBlock &sum, BitBlock &carry){ 9 10 static inline void bitwise_half_add(BitBlock x, BitBlock y, BitBlock &sum, BitBlock &carry){ 10 11 sum = simd_xor(x,y); 11 12 carry = simd_and(x,y); 13 } 14 15 static inline void bitwise_full_add(BitBlock x, BitBlock y, BitBlock z, BitBlock &sum, BitBlock &carry){ 16 BitBlock sum1, carry1; 17 bitwise_half_add(x, y, sum1, carry1); 18 sum = simd_xor(z, sum1); 19 carry = simd_or(carry1, simd_and(sum1, z)); 12 20 } 13 21 … … 36 44 BitBlock carry; 37 45 if(bitblock_has_bit(cur_newline)){ 38 half_add(cur_newline,BitParallelCounter[0],BitParallelCounter[0],carry);46 bitwise_half_add(cur_newline,BitParallelCounter[0],BitParallelCounter[0],carry); 39 47 last_block_with_newline = cur_newline; 40 48 blocks_after_last_newline_block = 0; 41 half_add(carry,BitParallelCounter[1],BitParallelCounter[1],carry);42 half_add(carry,BitParallelCounter[2],BitParallelCounter[2],carry);49 bitwise_half_add(carry,BitParallelCounter[1],BitParallelCounter[1],carry); 50 bitwise_half_add(carry,BitParallelCounter[2],BitParallelCounter[2],carry); 43 51 while(bitblock_has_bit(carry)){ 44 52 j++; 45 half_add(carry,BitParallelCounter[j],BitParallelCounter[j],carry);53 bitwise_half_add(carry,BitParallelCounter[j],BitParallelCounter[j],carry); 46 54 } 47 55 }
Note: See TracChangeset
for help on using the changeset viewer.