Ignore:
Timestamp:
Jun 9, 2016, 4:15:48 PM (3 years ago)
Author:
xuedongx
Message:

fix index

File:
1 edited

Legend:

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

    r5045 r5046  
    1717 ** ------------------------------------------------------------------------------------------------------------- */
    1818inline codepoint_t encodingByte(const codepoint_t cp, const unsigned n, bool UTF_16) {
    19         return UTF_16 ? UTF16_Encoder::encodingByte(cp, n) : UTF8_Encoder::encodingByte(cp, n);
     19    return UTF_16 ? UTF16_Encoder::encodingByte(cp, n) : UTF8_Encoder::encodingByte(cp, n);
    2020}
    2121
    2222inline unsigned length(const codepoint_t cp, bool UTF_16) {
    23         return UTF_16 ? UTF16_Encoder::length(cp) : UTF8_Encoder::length(cp);
     23    return UTF_16 ? UTF16_Encoder::length(cp) : UTF8_Encoder::length(cp);
    2424}
    2525
    2626inline codepoint_t maxCodePoint(const unsigned length, bool UTF_16) {
    27         return UTF_16 ?  UTF16_Encoder::maxCodePoint(length) : UTF8_Encoder::maxCodePoint(length);
     27    return UTF_16 ?  UTF16_Encoder::maxCodePoint(length) : UTF8_Encoder::maxCodePoint(length);
    2828}
    2929
    3030inline bool isLowCodePointAfterByte(const codepoint_t cp, const unsigned n, bool UTF_16) {
    31         return UTF_16 ? UTF16_Encoder::isLowCodePointAfterByte(cp, n) : UTF8_Encoder::isLowCodePointAfterByte(cp, n);
     31    return UTF_16 ? UTF16_Encoder::isLowCodePointAfterByte(cp, n) : UTF8_Encoder::isLowCodePointAfterByte(cp, n);
    3232}
    3333inline bool isHighCodePointAfterByte(const codepoint_t cp, const unsigned n, bool UTF_16) {
    34         return UTF_16 ? UTF16_Encoder::isHighCodePointAfterByte(cp, n) : UTF8_Encoder::isHighCodePointAfterByte(cp, n);
     34    return UTF_16 ? UTF16_Encoder::isHighCodePointAfterByte(cp, n) : UTF8_Encoder::isHighCodePointAfterByte(cp, n);
    3535}
    3636inline codepoint_t minCodePointWithCommonBytes(const re::codepoint_t cp, const unsigned n, bool UTF_16) {
    37         return UTF_16 ? UTF16_Encoder::minCodePointWithCommonBytes(cp, n) : UTF8_Encoder::minCodePointWithCommonBytes(cp, n);
     37    return UTF_16 ? UTF16_Encoder::minCodePointWithCommonBytes(cp, n) : UTF8_Encoder::minCodePointWithCommonBytes(cp, n);
    3838}
    3939inline codepoint_t maxCodePointWithCommonBytes(const re::codepoint_t cp, const unsigned n, bool UTF_16) {
    40         return UTF_16 ? UTF16_Encoder::maxCodePointWithCommonBytes(cp, n) : UTF8_Encoder::maxCodePointWithCommonBytes(cp, n);
     40    return UTF_16 ? UTF16_Encoder::maxCodePointWithCommonBytes(cp, n) : UTF8_Encoder::maxCodePointWithCommonBytes(cp, n);
    4141}
    4242
     
    271271                const auto lo_byte = encodingByte(lo, byte_no, isUTF_16);
    272272                const auto hi_byte = encodingByte(hi, byte_no, isUTF_16);
    273                 //std::cout << "lo_byte: " << std::hex << lo_byte << " hi_byte: " << std::hex << hi_byte << std::endl;
    274                                 if (lo_byte != hi_byte) {
    275                                         unsigned num = isUTF_16 ? 10 : 6;
     273                if (lo_byte != hi_byte) {
     274                    unsigned num = isUTF_16 ? 10 : 6;
    276275                    if (!isLowCodePointAfterByte(lo, byte_no, isUTF_16)) {
    277276                        const codepoint_t mid = lo | ((1 << (num * (min - byte_no))) - 1);
     
    334333
    335334    if (at_lo_boundary && at_hi_boundary) {
    336                 if (!isUTF_16) {
    337                         if (lo_byte != hi_byte) {
    338                                 if (lo == 0x80) lo_byte = 0xC0;
    339                                 if (hi == 0x10FFFF) hi_byte = 0xFF;
    340                         }
    341                 }
     335        if (!isUTF_16) {
     336            if (lo_byte != hi_byte) {
     337                if (lo == 0x80) lo_byte = 0xC0;
     338                if (hi == 0x10FFFF) hi_byte = 0xFF;
     339            }
     340        }
    342341        PabloAST * cc = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), builder);
    343342        target = builder.createAnd(cc, target);
     
    371370    assert (byte_no >= 1 && byte_no <= 4);
    372371    assert (byte_no == 1 || prefix != nullptr);
    373         bool isUTF_16 = mCharacterClassCompiler.isUTF_16();
     372    bool isUTF_16 = mCharacterClassCompiler.isUTF_16();
    374373    for (unsigned i = 1; i != byte_no; ++i) {
    375374        const CC * const cc = makeCC(encodingByte(cp, i, isUTF_16));
Note: See TracChangeset for help on using the changeset viewer.