diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-10-20 13:04:51 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-10-20 13:27:31 -0600 |
commit | 75929b4b01bac1759d29bba98f74642bca7f57ae (patch) | |
tree | cdb6dd734c1ef47db91bfa7a56bcddb0d48de0e4 /regcharclass.h | |
parent | 2358c533570dc87f10a95c0f732bcc2e93f75904 (diff) | |
download | perl-75929b4b01bac1759d29bba98f74642bca7f57ae.tar.gz |
regen/regcharclass.pl: Generate better code for some macros
This commit revamps the recently added function calculate_mask() to not
just work to give a single mask/compare value for its input and fail if
there are none, but to return a list of masks/compares when the set can
be split up into subsets that each can be represented by a mask/compare.
If this list taken as a whole yields fewer branches than what we get
otherwise, it is better code, and is used.
Said another way, what we had there before was all or nothing; this
works to improve things even if we can't do it all.
Diffstat (limited to 'regcharclass.h')
-rw-r--r-- | regcharclass.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/regcharclass.h b/regcharclass.h index b631cd19a8..17dee91816 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -193,12 +193,12 @@ /*** GENERATED CODE ***/ #define is_HORIZWS_latin1(s) \ -( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] || 0xA0 == ((U8*)s)[0] ) +( ((U8*)s)[0] == 0x09 || ( ( ((U8*)s)[0] & 0x7F ) == 0x20 ) ) /*** GENERATED CODE ***/ #define is_HORIZWS_latin1_safe(s,e) \ ( ((e)-(s) > 0) ? \ - ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] || 0xA0 == ((U8*)s)[0] ) \ + ( ((U8*)s)[0] == 0x09 || ( ( ((U8*)s)[0] & 0x7F ) == 0x20 ) ) \ : 0 ) /*** GENERATED CODE ***/ @@ -307,7 +307,7 @@ ( ( 0x90 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xAF ) ? 3 : 0 ) \ : ( ( 0xBF == ((U8*)s)[1] ) && ( ((U8*)s)[2] >= 0xBE ) ) ? 3 : 0 ) \ : ( 0xF0 == ((U8*)s)[0] ) ? \ - ( ( ( ( 0x9F == ((U8*)s)[1] || 0xAF == ((U8*)s)[1] || 0xBF == ((U8*)s)[1] ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 )\ + ( ( ( ( ((U8*)s)[1] == 0x9F || ( ( ((U8*)s)[1] & 0xEF ) == 0xAF ) ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 )\ : ( 0xF1 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0xF3 ) ? \ ( ( ( ( ( ((U8*)s)[1] & 0xCF ) == 0x8F ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 )\ : ( ( ( ( 0xF4 == ((U8*)s)[0] ) && ( 0x8F == ((U8*)s)[1] ) ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 ) @@ -560,12 +560,12 @@ ( ( 0xA5 == ((U8*)s)[1] ) ? \ ( ( ( 0xD6 == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ : ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD5 == ((U8*)s)[2] ) && ( 0xA5 == ((U8*)s)[3] || 0xAB == ((U8*)s)[3] || 0xAD == ((U8*)s)[3] || 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ + ( ( ( 0xD5 == ((U8*)s)[2] ) && ( ( ( ((U8*)s)[3] & 0xF7 ) == 0xA5 ) || ((U8*)s)[3] == 0xAB || ((U8*)s)[3] == 0xB6 ) ) ? 4 : 0 )\ : ( ( ( 0xBE == ((U8*)s)[1] ) && ( 0xD5 == ((U8*)s)[2] ) ) && ( 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ : ( 0xE1 == ((U8*)s)[0] ) ? \ ( ( 0xBC == ((U8*)s)[1] ) ? \ ( ( ( ( ( ((U8*)s)[2] & 0xD8 ) == 0x80 ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ - : ( ( ( ( 0xBD == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xF8 ) == 0xA0 || 0xB0 == ((U8*)s)[2] || 0xB4 == ((U8*)s)[2] || 0xBC == ((U8*)s)[2] ) ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ + : ( ( ( ( 0xBD == ((U8*)s)[1] ) && ( ( ( ((U8*)s)[2] & 0xF8 ) == 0xA0 ) || ((U8*)s)[2] == 0xB0 || ( ( ((U8*)s)[2] & 0xF7 ) == 0xB4 ) ) ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ : 0 ) \ : ((e)-(s) > 4) ? \ ( ( 0x61 == ((U8*)s)[0] ) ? \ @@ -612,12 +612,12 @@ ( ( 0xA5 == ((U8*)s)[1] ) ? \ ( ( ( 0xD6 == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ : ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD5 == ((U8*)s)[2] ) && ( 0xA5 == ((U8*)s)[3] || 0xAB == ((U8*)s)[3] || 0xAD == ((U8*)s)[3] || 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ + ( ( ( 0xD5 == ((U8*)s)[2] ) && ( ( ( ((U8*)s)[3] & 0xF7 ) == 0xA5 ) || ((U8*)s)[3] == 0xAB || ((U8*)s)[3] == 0xB6 ) ) ? 4 : 0 )\ : ( ( ( 0xBE == ((U8*)s)[1] ) && ( 0xD5 == ((U8*)s)[2] ) ) && ( 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ : ( 0xE1 == ((U8*)s)[0] ) ? \ ( ( 0xBC == ((U8*)s)[1] ) ? \ ( ( ( ( ( ((U8*)s)[2] & 0xD8 ) == 0x80 ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ - : ( ( ( ( 0xBD == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] & 0xF8 ) == 0xA0 || 0xB0 == ((U8*)s)[2] || 0xB4 == ((U8*)s)[2] || 0xBC == ((U8*)s)[2] ) ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ + : ( ( ( ( 0xBD == ((U8*)s)[1] ) && ( ( ( ((U8*)s)[2] & 0xF8 ) == 0xA0 ) || ((U8*)s)[2] == 0xB0 || ( ( ((U8*)s)[2] & 0xF7 ) == 0xB4 ) ) ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ : 0 ) \ : ((e)-(s) > 3) ? \ ( ( 0x61 == ((U8*)s)[0] ) ? \ @@ -664,7 +664,7 @@ ( ( 0xA5 == ((U8*)s)[1] ) ? \ ( ( ( 0xD6 == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ : ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD5 == ((U8*)s)[2] ) && ( 0xA5 == ((U8*)s)[3] || 0xAB == ((U8*)s)[3] || 0xAD == ((U8*)s)[3] || 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ + ( ( ( 0xD5 == ((U8*)s)[2] ) && ( ( ( ((U8*)s)[3] & 0xF7 ) == 0xA5 ) || ((U8*)s)[3] == 0xAB || ((U8*)s)[3] == 0xB6 ) ) ? 4 : 0 )\ : ( ( ( 0xBE == ((U8*)s)[1] ) && ( 0xD5 == ((U8*)s)[2] ) ) && ( 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ : 0 ) \ : ((e)-(s) > 2) ? \ @@ -703,13 +703,13 @@ ( ((e)-(s) > 2) ? \ ( ( ( ((U8*)s)[0] & 0xDF ) == 0x46 ) ? \ ( ( ( ((U8*)s)[1] & 0xDF ) == 0x46 ) ? \ - ( ( 0x49 == ((U8*)s)[2] || 0x4C == ((U8*)s)[2] || 0x69 == ((U8*)s)[2] || 0x6C == ((U8*)s)[2] ) ? 3 : 2 )\ - : ( 0x49 == ((U8*)s)[1] || 0x4C == ((U8*)s)[1] || 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 )\ - : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( 0x53 == ((U8*)s)[1] || 0x54 == ((U8*)s)[1] ) || ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ) ) ? 2 : 0 )\ + ( ( ( ( ((U8*)s)[2] & 0xDF ) == 0x49 ) || ( ( ((U8*)s)[2] & 0xDF ) == 0x4C ) ) ? 3 : 2 )\ + : ( ( ( ((U8*)s)[1] & 0xDF ) == 0x49 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x4C ) ) ? 2 : 0 )\ + : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( ( ((U8*)s)[1] & 0xDF ) == 0x53 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\ : ((e)-(s) > 1) ? \ ( ( ( ((U8*)s)[0] & 0xDF ) == 0x46 ) ? \ - ( ( 0x46 == ((U8*)s)[1] || 0x49 == ((U8*)s)[1] || 0x4C == ((U8*)s)[1] || 0x66 == ((U8*)s)[1] || 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 )\ - : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( 0x53 == ((U8*)s)[1] || 0x54 == ((U8*)s)[1] ) || ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ) ) ? 2 : 0 )\ + ( ( ( ( ((U8*)s)[1] & 0xDF ) == 0x46 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x49 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x4C ) ) ? 2 : 0 )\ + : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( ( ((U8*)s)[1] & 0xDF ) == 0x53 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\ : 0 ) |