diff options
author | Karl Williamson <khw@cpan.org> | 2015-11-06 09:36:54 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2015-12-05 22:06:50 -0700 |
commit | c9264833f11097be9260ee01f005239f2fbd4ee6 (patch) | |
tree | bad6b22cd294e6545325b3906ceffb4232112b9a /utf8.h | |
parent | 4c8cd60559ce65964c5e42f43021ce23dc89819e (diff) | |
download | perl-c9264833f11097be9260ee01f005239f2fbd4ee6.tar.gz |
utf8.h: Move #define to earlier in the file
And use its mnemonic in other #defines instead of repeating the raw
value.
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -208,9 +208,13 @@ Perl's extended UTF-8 means we can have start bytes up to FF. * */ #define UVCHR_IS_INVARIANT(cp) OFFUNI_IS_INVARIANT(cp) +/* This defines the bits that are to be in the continuation bytes of a multi-byte + * UTF-8 encoded character that mark it is a continuation byte. */ +#define UTF_CONTINUATION_MARK 0x80 + /* Misleadingly named: is the UTF8-encoded byte 'c' part of a variant sequence * in UTF-8? This is the inverse of UTF8_IS_INVARIANT */ -#define UTF8_IS_CONTINUED(c) (((U8)c) & 0x80) +#define UTF8_IS_CONTINUED(c) (((U8)c) & UTF_CONTINUATION_MARK) /* Is the byte 'c' the first byte of a multi-byte UTF8-8 encoded sequence? * This doesn't catch invariants (they are single-byte). It also excludes the @@ -219,7 +223,7 @@ Perl's extended UTF-8 means we can have start bytes up to FF. /* Is the byte 'c' part of a multi-byte UTF8-8 encoded sequence, and not the * first byte thereof? */ -#define UTF8_IS_CONTINUATION(c) ((((U8)c) & 0xC0) == 0x80) +#define UTF8_IS_CONTINUATION(c) ((((U8)c) & 0xC0) == UTF_CONTINUATION_MARK) /* Is the UTF8-encoded byte 'c' the first byte of a two byte sequence? Use * UTF8_IS_NEXT_CHAR_DOWNGRADEABLE() instead if the input isn't known to @@ -231,10 +235,6 @@ Perl's extended UTF-8 means we can have start bytes up to FF. * represent a code point > 255? */ #define UTF8_IS_ABOVE_LATIN1(c) ((U8)(c) >= 0xc4) -/* This defines the bits that are to be in the continuation bytes of a multi-byte - * UTF-8 encoded character that indicate it is a continuation byte. */ -#define UTF_CONTINUATION_MARK 0x80 - /* This is the number of low-order bits a continuation byte in a UTF-8 encoded * sequence contributes to the specification of the code point. In the bit * maps above, you see that the first 2 bits are a constant '10', leaving 6 of |