From: Karl Williamson Date: Sun, 16 Sep 2012 16:58:26 +0000 (-0600) Subject: utf8.h: Add macro to test if UTF8 code point isn't Latin1 X-Git-Tag: upstream/5.20.0~5410 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b4252f49b5cd844c918f7f2cb81e064d4377ba9;p=platform%2Fupstream%2Fperl.git utf8.h: Add macro to test if UTF8 code point isn't Latin1 --- diff --git a/utf8.h b/utf8.h index bf8251a..30537a8 100644 --- a/utf8.h +++ b/utf8.h @@ -170,6 +170,7 @@ Perl's extended UTF-8 means we can have start bytes up to FF. /* Masking with 0xfe allows low bit to be 0 or 1; thus this matches 0xc[23] */ #define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfe) == 0xc2) +#define UTF8_IS_ABOVE_LATIN1(c) ((U8)(c) >= 0xc4) #define UTF_START_MARK(len) (((len) > 7) ? 0xFF : (0xFE << (7-(len)))) diff --git a/utfebcdic.h b/utfebcdic.h index 3eba83d..1662103 100644 --- a/utfebcdic.h +++ b/utfebcdic.h @@ -570,6 +570,7 @@ END_EXTERN_C #define UTF8_IS_CONTINUATION(c) ((NATIVE_TO_UTF(c) & 0xE0) == 0xA0) #define UTF8_IS_CONTINUED(c) (NATIVE_TO_UTF(c) >= 0xA0) #define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_TO_UTF(c) >= 0xC5 && NATIVE_TO_UTF(c) <= 0xC7) +#define UTF8_IS_ABOVE_LATIN1(c) (NATIVE_TO_I8(c) >= 0xC8) #define UTF_START_MARK(len) (((len) > 7) ? 0xFF : ((U8)(0xFE << (7-(len))))) #define UTF_START_MASK(len) (((len) >= 6) ? 0x01 : (0x1F >> ((len)-2)))