Changeset 839


Ignore:
Timestamp:
Dec 18, 2010, 6:07:31 AM (8 years ago)
Author:
cameron
Message:

New function: bitwise_full_add.

File:
1 edited

Legend:

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

    r838 r839  
    11/*  Parallel Bitwise Tracking of Line Number/Column Number
    2     Copyright (C) 2010, Dan Lin
     2    Copyright (C) 2010, Dan Lin and Robert D. Cameron
    33    Licensed to the public under the Open Software License 3.0.
    44    Licensed to International Characters Inc.
     
    77
    88#define MAX_COUNTER_BITS 24
    9 static inline void half_add(BitBlock x, BitBlock y, BitBlock &sum, BitBlock &carry){
     9
     10static inline void bitwise_half_add(BitBlock x, BitBlock y, BitBlock &sum, BitBlock &carry){
    1011  sum = simd_xor(x,y);
    1112  carry = simd_and(x,y);
     13}
     14
     15static 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));
    1220}
    1321
     
    3644  BitBlock carry;
    3745  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);
    3947    last_block_with_newline = cur_newline;
    4048    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);
    4351    while(bitblock_has_bit(carry)){
    4452      j++;
    45       half_add(carry,BitParallelCounter[j],BitParallelCounter[j],carry);
     53      bitwise_half_add(carry,BitParallelCounter[j],BitParallelCounter[j],carry);
    4654    }
    4755  }
Note: See TracChangeset for help on using the changeset viewer.