Ignore:
Timestamp:
Jul 10, 2010, 12:25:01 PM (9 years ago)
Author:
cameron
Message:

carry_or defined, updates for MSVC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/compiled/block_carry.h

    r457 r459  
    44    Licensed to International Characters Inc.
    55       under the Academic Free License version 3.0.
     6
     7This file defines addition, subtract and shift operations on
     8128-bit blocks.   Different versions of the operations are
     9selectable with the CARRY_STRATEGY preprocessor constant.
     10
     11Each implementation defines the following "abstract data type"
     12for block operations with carry.
     13
     14Typename:   CarryType
     15Constant:   Carry0  represents a value of 0 for the carry bit.
     16Predicate:  test_carry(x) returns nonzero if a carry bit is 1, 0 otherwise.
     17Function:   carry_or(carry1, carry2) forms the logical or of two carries.
     18Function:   adc128(x, y, carry, sum) computes (carry, sum) = x + y + carry,
     19Function:   advance_with_carry(cursor, carry, rslt)
     20                 computes (carry, rslt) = cursor + cursor + carry
     21Function:   sbb128(x, y, borrow, diff)
     22                 computes (borrow, diff) = y - x - borrow
     23
    624*/
    725#ifndef BLOCK_CARRY_H
    826#define BLOCK_CARRY_H
    927
     28
     29
     30
     31
    1032/*------------------------------------------------------------*/
    1133#include "sse_simd.h"
     
    2345
    2446#define test_carry(x) ((x) > 0)
     47
     48#define carry_or(carry1, carry2) (carry1 | carry2)
    2549
    2650#define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \
     
    7296         : "cc")
    7397
    74 #define sbb128(first, second, carry, sum) \
     98#define sbb128(first, second, borrow, diff) \
    7599do\
    76100{ union {__m128i bitblock;\
     
    87111\
    88112  double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \
    89                    rslt.int64[0], rslt.int64[1], carry);\
    90   sum = rslt.bitblock;\
     113                   rslt.int64[0], rslt.int64[1], borrow);\
     114  diff = rslt.bitblock;\
    91115}while(0)
    92116
     
    99123
    100124#define test_carry(x) (((x)&256) > 0)
     125
     126#define carry_or(carry1, carry2) (carry1 | carry2)
    101127
    102128#define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \
     
    147173         : "cc")
    148174
    149 #define sbb128(first, second, carry, sum) \
     175#define sbb128(first, second, borrow, diff) \
    150176do\
    151177{ union {__m128i bitblock;\
     
    162188\
    163189  double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \
    164                    rslt.int64[0], rslt.int64[1], carry);\
    165   sum = rslt.bitblock;\
     190                   rslt.int64[0], rslt.int64[1], borrow);\
     191  diff = rslt.bitblock;\
    166192}while(0)
    167193
     
    177203
    178204#define test_carry(x) bitblock_has_bit(x)
     205
     206#define carry_or(carry1, carry2) simd_or(carry1, carry2)
    179207
    180208#define adc128(x, y, carry,  sum) \
Note: See TracChangeset for help on using the changeset viewer.