Ignore:
Timestamp:
Feb 24, 2010, 4:35:15 PM (9 years ago)
Author:
lindanl
Message:

Buffered version; fix error report for surrogate at block boundary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/u16u8/u16u8_compilable2.py

    r359 r366  
    2929
    3030def main(u16h, u16l, mask, u16):
    31        
     31        #optimize(above_0x7FF,allzero)
     32        #optimize(above_0x7F,allzero)
     33        above_0x7FF =  ((u16h[0] | u16h[1]) | (u16h[2] | u16h[3])) | u16h[4]
     34        above_0x7F = ((above_0x7FF | u16h[5]) | (u16h[6] | u16h[7])) | u16l[0]
     35
    3236        # Surrogate pairs have 0xD8 through 0xDF as the high UTF-16 byte: 11011xxx pattern
    3337        u16.surrogate = (u16h[0] & u16h[1]) & (u16h[3] &~ u16h[2]) & u16h[4]
     
    3640        u16.lsurrogate = u16.surrogate & u16h[5]
    3741        # If any of the high 5 bits are set, we are above the 07FF range
    38         above_0x7FF =  ((u16h[0] | u16h[1]) | (u16h[2] | u16h[3])) | u16h[4]
    39         above_0x7F = ((above_0x7FF | u16h[5]) | (u16h[6] | u16h[7])) | u16l[0]
    4042        u16.utf8_3  = above_0x7FF &~ u16.surrogate
    4143        u16.utf8_2 = above_0x7F & ~above_0x7FF
    42         u16.ASCII = ~above_0x7F & mask
     44        u16.ASCII = ~above_0x7F
    4345        u16.error = bitutil.Advance(u16.hsurrogate) ^ u16.lsurrogate
    4446       
Note: See TracChangeset for help on using the changeset viewer.