diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-09-04 14:54:26 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-09-13 21:14:03 -0600 |
commit | 2efb81438aa4370f4aeabca6e03ab28f3bd552fb (patch) | |
tree | 3c1c3c037b9d222071b2e236132c404257f5b9b1 /regcharclass.h | |
parent | 4a8ca70e2b2f2bbcb16262c5223a444f59bf9d91 (diff) | |
download | perl-2efb81438aa4370f4aeabca6e03ab28f3bd552fb.tar.gz |
regen/regcharclass.pl: Add an optimization
Branches can be eliminated from the macros that are generated here
by using a mask in cases where applicable. This adds checking to see if
this optimization is possible, and applies it if so.
Diffstat (limited to 'regcharclass.h')
-rw-r--r-- | regcharclass.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/regcharclass.h b/regcharclass.h index a7e79ada56..27ed2e8b5d 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -31,7 +31,7 @@ ( ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) \ : ( 0x85 == ((U8*)s)[0] ) ) @@ -45,7 +45,7 @@ ( ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) \ : ( 0x85 == ((U8*)s)[0] ) ) \ : ((e)-(s) > 1) ? \ @@ -70,7 +70,7 @@ : ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) /*** GENERATED CODE ***/ @@ -82,7 +82,7 @@ : ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) \ : ((e)-(s) > 1) ? \ ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ @@ -261,7 +261,7 @@ ( ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) \ : ( 0x85 == ((U8*)s)[0] ) ) @@ -273,7 +273,7 @@ ( ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) \ : ( 0x85 == ((U8*)s)[0] ) ) \ : ((e)-(s) > 1) ? \ @@ -294,7 +294,7 @@ : ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) /*** GENERATED CODE ***/ @@ -304,7 +304,7 @@ : ( 0xC2 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 == ((U8*)s)[1] ) && ( 0xA8 == ((U8*)s)[2] || 0xA9 == ((U8*)s)[2] ) ) ? 3 : 0 )\ + ( ( ( 0x80 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : 0 ) \ : ((e)-(s) > 1) ? \ ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ @@ -341,9 +341,9 @@ #define is_GCB_L_utf8(s) \ ( ( 0xE1 == ((U8*)s)[0] ) ? \ ( ( 0x84 == ((U8*)s)[1] ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x9F ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xE0 ) == 0x80 ) ? 3 : 0 ) \ : 0 ) \ : ( 0xEA == ((U8*)s)[0] ) ? \ ( ( ( 0xA5 == ((U8*)s)[1] ) && ( 0xA0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBC ) ) ? 3 : 0 )\ @@ -358,17 +358,17 @@ #define is_GCB_LV_LVT_V_utf8(s) \ ( ( 0xE1 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0xA0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xE0 ) == 0xA0 ) ? 3 : 0 ) \ : ( 0x86 == ((U8*)s)[1] ) ? \ ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA7 ) ? 3 : 0 ) \ : 0 ) \ : ( 0xEA == ((U8*)s)[0] ) ? \ - ( ( ( 0xB0 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0xBF ) && ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ) ? 3 : 0 )\ + ( ( ( ( ((U8*)s)[1] & 0xF0 ) == 0xB0 ) && ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ) ? 3 : 0 )\ : ( 0xEB == ((U8*)s)[0] || 0xEC == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0xBF ) && ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ) ? 3 : 0 )\ + ( ( ( ( ((U8*)s)[1] & 0xC0 ) == 0x80 ) && ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ) ? 3 : 0 )\ : ( 0xED == ((U8*)s)[0] ) ? \ ( ( 0x80 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x9D ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0x9E == ((U8*)s)[1] ) ? \ ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA3 ) || ( 0xB0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ) ? 3 : 0 )\ : ( 0x9F == ((U8*)s)[1] ) ? \ @@ -401,18 +401,18 @@ */ /*** GENERATED CODE ***/ #define is_GCB_SPECIAL_BEGIN_utf8(s) \ -( ( ( 0xE1 == ((U8*)s)[0] ) && ( 0x84 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x87 ) ) ? ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 )\ +( ( ( 0xE1 == ((U8*)s)[0] ) && ( ( ((U8*)s)[1] & 0xFC ) == 0x84 ) ) ? ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 )\ : ( 0xEA == ((U8*)s)[0] ) ? \ ( ( 0xA5 == ((U8*)s)[1] ) ? \ ( ( 0xA0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBC ) ? 3 : 0 ) \ - : ( 0xB0 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0xBF ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + : ( ( ((U8*)s)[1] & 0xF0 ) == 0xB0 ) ? \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : 0 ) \ : ( 0xEB == ((U8*)s)[0] || 0xEC == ((U8*)s)[0] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0xBF ) && ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ) ? 3 : 0 )\ + ( ( ( ( ((U8*)s)[1] & 0xC0 ) == 0x80 ) && ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ) ? 3 : 0 )\ : ( 0xED == ((U8*)s)[0] ) ? \ ( ( 0x80 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x9D ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0x9E == ((U8*)s)[1] ) ? \ ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA3 ) || ( 0xB0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ) ? 3 : 0 )\ : ( 0x9F == ((U8*)s)[1] ) ? \ @@ -433,7 +433,7 @@ ( ( 0x86 == ((U8*)s)[1] ) ? \ ( ( 0xA8 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ : ( 0x87 == ((U8*)s)[1] ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : 0 ) \ : ( 0xED == ((U8*)s)[0] ) ? \ ( ( ( 0x9F == ((U8*)s)[1] ) && ( 0x8B <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBB ) ) ? 3 : 0 )\ @@ -448,13 +448,13 @@ #define is_GCB_V_utf8(s) \ ( ( 0xE1 == ((U8*)s)[0] ) ? \ ( ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0xA0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xE0 ) == 0xA0 ) ? 3 : 0 ) \ : ( 0x86 == ((U8*)s)[1] ) ? \ ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA7 ) ? 3 : 0 ) \ : 0 ) \ : ( 0xED == ((U8*)s)[0] ) ? \ ( ( 0x9E == ((U8*)s)[1] ) ? \ - ( ( 0xB0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xF0 ) == 0xB0 ) ? 3 : 0 ) \ : ( 0x9F == ((U8*)s)[1] ) ? \ ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x86 ) ? 3 : 0 ) \ : 0 ) \ @@ -475,7 +475,7 @@ : ( 0x9A == ((U8*)s)[1] ) ? \ ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ : ( 0x9E == ((U8*)s)[1] ) ? \ - ( ( 0xB4 == ((U8*)s)[2] || 0xB5 == ((U8*)s)[2] ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xFE ) == 0xB4 ) ? 3 : 0 ) \ : ( 0xA0 == ((U8*)s)[1] ) ? \ ( ( 0x8B <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8E ) ? 3 : 0 ) \ : 0 ) \ @@ -487,17 +487,17 @@ : ( 0x86 == ((U8*)s)[1] ) ? \ ( ( 0x90 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ : ( 0x87 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x90 ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0x91 == ((U8*)s)[1] ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x9F ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xE0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0x94 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x9C ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0x9D == ((U8*)s)[1] ) ? \ ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xB5 ) ? 3 : 0 ) \ : ( 0x9E == ((U8*)s)[1] ) ? \ ( ( 0x94 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ : ( ( 0x9F <= ((U8*)s)[1] && ((U8*)s)[1] <= 0xAF ) || 0xB8 == ((U8*)s)[1] || 0xB9 == ((U8*)s)[1] ) ?\ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ? 3 : 0 ) \ : 0 ) \ : ( 0xE3 == ((U8*)s)[0] ) ? \ ( ( 0x80 == ((U8*)s)[1] ) ? \ @@ -507,9 +507,9 @@ : 0 ) \ : ( 0xEF == ((U8*)s)[0] ) ? \ ( ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( 0xBE == ((U8*)s)[2] || 0xBF == ((U8*)s)[2] ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xFE ) == 0xBE ) ? 3 : 0 ) \ : ( 0xB8 == ((U8*)s)[1] ) ? \ - ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8F ) ? 3 : 0 ) \ + ( ( ( ((U8*)s)[2] & 0xF0 ) == 0x80 ) ? 3 : 0 ) \ : ( 0xB9 == ((U8*)s)[1] ) ? \ ( ( 0x85 == ((U8*)s)[2] || 0x86 == ((U8*)s)[2] ) ? 3 : 0 ) \ : ( 0xBB == ((U8*)s)[1] ) ? \ @@ -522,7 +522,7 @@ : ( 0xF0 == ((U8*)s)[0] ) ? \ ( ( ( ( 0x9D == ((U8*)s)[1] ) && ( 0x85 == ((U8*)s)[2] ) ) && ( 0xB3 <= ((U8*)s)[3] && ((U8*)s)[3] <= 0xBA ) ) ? 4 : 0 )\ : ( 0xF3 == ((U8*)s)[0] ) ? \ - ( ( ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBF ) ) && ( 0x80 <= ((U8*)s)[3] && ((U8*)s)[3] <= 0xBF ) ) ? 4 : 0 )\ + ( ( ( ( 0xA0 == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xC0 ) == 0x80 ) ) && ( ( ((U8*)s)[3] & 0xC0 ) == 0x80 ) ) ? 4 : 0 )\ : 0 ) |