Ignore:
Timestamp:
Aug 5, 2018, 9:06:54 PM (11 months ago)
Author:
xwa163
Message:

UTF-8 support for Multiplexing LZ4 Grep

File:
1 edited

Legend:

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

    r6133 r6140  
    123123        cc::doMultiplexCCs(CCs, mExclusiveSetIDs, mMultiplexedCCs);
    124124}
    125    
     125
     126unsigned long MultiplexedAlphabet::findTargetCCIndex(const re::CC * sourceCC) const {
     127    auto f = find(mUnicodeSets.begin(), mUnicodeSets.end(), sourceCC);
     128    if (f != mUnicodeSets.end()) {
     129        return f - mUnicodeSets.begin();
     130    }
     131
     132    const UCD::UnicodeSet* sourceUcd = sourceCC;
     133    for (unsigned long i = 0; i < mUnicodeSets.size(); i++) {
     134        UCD::UnicodeSet* t = mUnicodeSets[i];
     135        if (*t == *sourceUcd) {
     136            return i;
     137        }
     138    }
     139    llvm::report_fatal_error(Printer_RE::PrintRE(sourceCC) + " not found");
     140}
     141
    126142re::CC * MultiplexedAlphabet::transformCC(const re::CC * sourceCC) const {
    127143    if (sourceCC->getAlphabet() != mSourceAlphabet) {
    128144        llvm::report_fatal_error("Mismatched source alphabets for transformCC");
    129145    }
    130     const auto f = find(mUnicodeSets.begin(), mUnicodeSets.end(), sourceCC);
    131     if (f == mUnicodeSets.end()) {
    132         llvm::report_fatal_error(Printer_RE::PrintRE(sourceCC) + " not found");
    133     }
    134     const auto index = f - mUnicodeSets.begin();
     146
     147    const auto index = this->findTargetCCIndex(sourceCC);
    135148    const auto exclusive_IDs = mExclusiveSetIDs[index];
    136149    re::CC * CC_union = re::makeCC(this);
Note: See TracChangeset for help on using the changeset viewer.