Changeset 4318 for icGREP


Ignore:
Timestamp:
Dec 3, 2014, 11:49:39 AM (5 years ago)
Author:
cameron
Message:

Don't make impossible ranges

File:
1 edited

Legend:

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

    r4316 r4318  
    4949        codepoint_t negative_subrange_lo = subrange_lo + fe.fold_offset;
    5050        codepoint_t negative_subrange_hi = subrange_lo + 2 * fe.fold_offset - 1;
    51           base_cc -> insert_range(std::max(negative_subrange_lo,lo1) - fe.fold_offset, std::min(negative_subrange_hi, hi1) - fe.fold_offset);
     51        if ((lo1 <= negative_subrange_hi) && (hi1 >= negative_subrange_lo)) {
     52           // negative offsets apply
     53           base_cc -> insert_range(std::max(negative_subrange_lo,lo1) - fe.fold_offset, std::min(negative_subrange_hi, hi1) - fe.fold_offset);
     54        }
    5255        // Now the positive offset subrange.
    5356        codepoint_t positive_subrange_lo = hi1 - ((hi1 - fe.range_lo) % (2 * fe.fold_offset));
    5457        codepoint_t positive_subrange_hi = positive_subrange_lo + fe.fold_offset - 1;
    55         base_cc -> insert_range(std::max(positive_subrange_lo, lo1) + fe.fold_offset, std::min(positive_subrange_hi, hi1) + fe.fold_offset);
     58        if ((lo1 <= positive_subrange_hi) && (hi1 >= positive_subrange_lo)) {
     59           base_cc -> insert_range(std::max(positive_subrange_lo, lo1) + fe.fold_offset, std::min(positive_subrange_hi, hi1) + fe.fold_offset);
     60        }
    5661      }
    5762      else if (fe.fold_offset != 0) {
Note: See TracChangeset for help on using the changeset viewer.