Changeset 848


Ignore:
Timestamp:
Dec 22, 2010, 12:04:39 PM (8 years ago)
Author:
cameron
Message:

Reorder u8u16 defs for 2/3/4 byte optimization

Location:
proto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/inputs/input_UTF8_defs

    r609 r848  
    55u8.prefix4 = [\xF0-\xFF]
    66u8.suffix = [\x80-\xBF]
    7 u8.badprefix = [\xC0-\xC1\xF5-\xFF]
     7# For 2 byte-sequence validation
     8u8.badprefix2 = [\xC0-\xC1]
     9# For 3 byte-sequence validation
    810u8.xE0 = [\xE0]
    911u8.xED = [\xED]
     12u8.xA0_xBF = [\xA0-\xBF]
     13u8.x80_x9F = [\x80-\x9F]
     14# 4 byte sequence validation
     15u8.badprefix4 = [\xF5-\xFF]
    1016u8.xF0 = [\xF0]
    1117u8.xF4 = [\xF4]
    12 u8.xA0_xBF = [\xA0-\xBF]
    13 u8.x80_x9F = [\x80-\x9F]
    1418u8.x90_xBF = [\x90-\xBF]
    1519u8.x80_x8F = [\x80-\x8F]
     20
  • proto/u8u16/u8u16_pablo.py

    r774 r848  
    88  prefix4 = 0
    99  suffix = 0
    10   badprefix = 0
    11   xE0 = 0
    12   xED = 0
    13   xF0 = 0
    14   xF4 = 0
    15   xA0_xBF = 0
    16   x80_x9F = 0
    17   x90_xBF = 0
    18   x80_x8F = 0
    19   xEF = 0
    20   xBF = 0
    21   xBE = 0
    2210  scope22 = 0
    2311  scope32 = 0
     
    4735        temp5 = (bit[4] | bit[5]);
    4836        temp6 = (temp5 | bit[6]);
    49         temp7 = (temp4 &~ temp6);
    50         temp8 = (bit[6] | bit[7]);
    51         temp9 = (bit[5] & temp8);
    52         temp10 = (bit[4] | temp9);
    53         temp11 = (u8.prefix4 & temp10);
    54         u8.badprefix = (temp7 | temp11);
    55         temp12 = (temp5 | temp8);
    56         xE0 = (u8.prefix3 &~ temp12);
    57         temp13 = (bit[4] & bit[5]);
    58         temp14 = (bit[7] &~ bit[6]);
    59         temp15 = (temp13 & temp14);
    60         xED = (u8.prefix3 & temp15);
    61         xF0 = (u8.prefix4 &~ temp12);
    62         temp16 = (bit[5] &~ bit[4]);
    63         temp17 = (temp16 &~ temp8);
    64         xF4 = (u8.prefix4 & temp17);
     37        badprefix2 = (temp4 &~ temp6);
     38        temp7 = (bit[6] | bit[7]);
     39        temp8 = (temp5 | temp7);
     40        xE0 = (u8.prefix3 &~ temp8);
     41        temp9 = (bit[4] & bit[5]);
     42        temp10 = (bit[7] &~ bit[6]);
     43        temp11 = (temp9 & temp10);
     44        xED = (u8.prefix3 & temp11);
    6545        xA0_xBF = (u8.suffix & bit[2]);
    6646        x80_x9F = (u8.suffix &~ bit[2]);
     47        temp12 = (bit[5] & temp7);
     48        temp13 = (bit[4] | temp12);
     49        badprefix4 = (u8.prefix4 & temp13);
     50        xF0 = (u8.prefix4 &~ temp8);
     51        temp14 = (bit[5] &~ bit[4]);
     52        temp15 = (temp14 &~ temp7);
     53        xF4 = (u8.prefix4 & temp15);
    6754        x90_xBF = (u8.suffix & temp3);
    6855        x80_x8F = (u8.suffix &~ temp3);
     
    8673             
    8774        # C0-C1 and F5-FF are illegal
    88         error_mask = u8.badprefix
     75        error_mask = badprefix2 | badprefix4
    8976             
    9077        error_mask |= bitutil.Advance(xE0) & x80_x9F
Note: See TracChangeset for help on using the changeset viewer.