Ignore:
Timestamp:
Jun 14, 2018, 10:41:45 AM (13 months ago)
Author:
cameron
Message:

Little-endian/big-endian bit number options, default to little-endian

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r6069 r6089  
    2626    : mBuilder(scope) {
    2727    }
    28    
    29 
    30 Parabix_CC_Compiler::Parabix_CC_Compiler(pablo::PabloBlock * scope, std::vector<pablo::PabloAST *> basisBitSet)
     28
     29Parabix_CC_Compiler::Parabix_CC_Compiler(pablo::PabloBlock * scope, std::vector<pablo::PabloAST *> basisBitSet, cc::BitNumbering basisSetNumbering)
    3130: CC_Compiler(scope)
    3231, mEncodingBits(basisBitSet.size())
     32, mBasisSetNumbering(basisSetNumbering)
    3333, mBasisBit(basisBitSet) {
    3434    mEncodingMask = (static_cast<unsigned>(1) << mEncodingBits) - static_cast<unsigned>(1);
     
    224224    llvm::report_fatal_error(std::string("Invalid Character Set Range: [") + std::to_string(lo) + "," + std::to_string(hi) + "]");
    225225}
    226 //#define LITTLE_ENDIAN_BIT_NUMBERING
    227226
    228227inline PabloAST * Parabix_CC_Compiler::getBasisVar(const unsigned i) const {
    229228    assert (i < mEncodingBits);
    230 #ifndef LITTLE_ENDIAN_BIT_NUMBERING
    231     const unsigned index = mEncodingBits - i - 1; assert (index < mEncodingBits);
    232 #else
    233     const unsigned index = i;
    234 #endif
    235     assert (mBasisBit[index]);
    236     return mBasisBit[index];
     229    if (mBasisSetNumbering == cc::BitNumbering::BigEndian)
     230        return mBasisBit[mEncodingBits - i - 1];
     231    else return mBasisBit[i];
    237232}
    238233
Note: See TracChangeset for help on using the changeset viewer.