summaryrefslogtreecommitdiff
path: root/utfebcdic.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-08-02 09:02:51 -0600
committerKarl Williamson <khw@cpan.org>2015-09-04 10:21:18 -0600
commit5352a76315308cf38aae6f4e6f20f967d5c88300 (patch)
treedde847c8645bb8104019c637c05dad0139f84ade /utfebcdic.h
parent38953e5a3d6b2697bc45b2caa0f7d48e6f834f90 (diff)
downloadperl-5352a76315308cf38aae6f4e6f20f967d5c88300.tar.gz
Change EBCDIC macro definition
Prior to this commit UVCHR_SKIP() was defined the same in both ASCII and EBCDIC, but they expanded to different things. Now, they are defined separately -- to what they expand to, and the EBCDIC version is changed when all expanded out to use PL_charclass[] instead of PL_e2a[]. The new array is more likely to be in the memory cache.
Diffstat (limited to 'utfebcdic.h')
-rw-r--r--utfebcdic.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/utfebcdic.h b/utfebcdic.h
index c6c1d21d9b..cf057fed61 100644
--- a/utfebcdic.h
+++ b/utfebcdic.h
@@ -179,6 +179,12 @@ END_EXTERN_C
#define UVCHR_IS_INVARIANT(uv) cBOOL(FITS_IN_8_BITS(uv) \
&& (PL_charclass[(U8) (uv)] & (_CC_mask(_CC_ASCII) | _CC_mask(_CC_CNTRL))))
+#define UVCHR_SKIP(uv) (UVCHR_IS_INVARIANT(uv) ? 1 : \
+ (uv) < 0x400 ? 2 : \
+ (uv) < 0x4000 ? 3 : \
+ (uv) < 0x40000 ? 4 : \
+ (uv) < 0x400000 ? 5 : \
+ (uv) < 0x4000000 ? 6 : 7 )
/* UTF-EBCDIC semantic macros - We used to transform back into I8 and then
* compare, but now only have to do a single lookup by using a bit in