Ignore:
Timestamp:
Mar 13, 2018, 1:26:31 PM (16 months ago)
Author:
nmedfort
Message:

Bug fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/unicode_set.cpp

    r5904 r5909  
    141141        if (LLVM_UNLIKELY(type != Empty && type != Mixed && type != Full)) {
    142142            report_fatal_error("illegal run type " + std::to_string(type) + " found");
    143             return false;
    144143        }
    145144        const auto l = lengthOf(runs[i]);
    146145        if (LLVM_UNLIKELY(l == 0)) {
    147146            report_fatal_error("zero-length quad found");
    148             return false;
    149147        }
    150148        if (type == Mixed) {
     
    155153    if (LLVM_UNLIKELY(sum != UNICODE_QUAD_COUNT)) {
    156154        report_fatal_error("found " + std::to_string(sum) + " quads but expected " + std::to_string(UNICODE_QUAD_COUNT));
    157         return false;
    158155    }
    159156    if (LLVM_UNLIKELY(mixedQuads != quadLength)) {
    160157        report_fatal_error("found " + std::to_string(quadLength) + " mixed quad(s) but expected " + std::to_string(mixedQuads));
    161         return false;
    162158    }
    163159    for (unsigned i = 0; i < quadLength; ++i) {
    164160        if (LLVM_UNLIKELY((quads[i] == 0) || (quads[i] == FULL_QUAD_MASK))) {
    165161            report_fatal_error("Empty or Full quad found in Mixed quad array");
    166             return false;
    167162        }
    168163    }
     
    603598            std::memcpy(quads, mQuads, (quadIndex - 1) * sizeof(bitquad_t));
    604599            quads[quadIndex] = mQuads[quadIndex] | value;
    605             const unsigned offset = (quads[quadIndex] == FULL_QUAD_MASK) ? 1 : 0;
     600            const unsigned quadOffset = (quads[quadIndex] == FULL_QUAD_MASK) ? 1 : 0;
    606601            mQuadCapacity = mQuadLength;
    607             mQuadLength -= offset;
     602            mQuadLength -= quadOffset;
    608603            ++quadIndex;
    609             std::memcpy(quads + quadIndex, mQuads + quadIndex + offset, (mQuadLength - quadIndex) * sizeof(bitquad_t));
     604            std::memcpy(quads + quadIndex, mQuads + quadIndex + quadOffset, (mQuadLength - quadIndex) * sizeof(bitquad_t));
    610605            mQuads = quads;
    611             if (LLVM_LIKELY(offset == 0)) {  // no change to runs needed
     606            if (LLVM_LIKELY(quadOffset == 0)) {  // no change to runs needed
    612607                assert (verify(mRuns, mRunLength, mQuads, mQuadLength));
    613608                assert (contains(cp));
    614609                return;
    615610            }
    616 
    617611        } else { // reuse the buffer
    618612            mQuads[quadIndex] |= value;
    619             if (LLVM_LIKELY(mQuads[quadIndex] == FULL_QUAD_MASK)) { // no change to runs needed
     613            if (LLVM_LIKELY(mQuads[quadIndex] != FULL_QUAD_MASK)) { // no change to runs needed
    620614                assert (verify(mRuns, mRunLength, mQuads, mQuadLength));
    621615                assert (contains(cp));
Note: See TracChangeset for help on using the changeset viewer.