diff options
author | Karl Williamson <khw@cpan.org> | 2020-06-30 14:04:24 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-05-28 15:23:57 -0600 |
commit | 08e4a1ef4d8dab2b623fc6d1bdad38d849b7d04f (patch) | |
tree | 939c0f2640fe2998474047b5f1c913a2aa45fcd9 /utf8.h | |
parent | 21e13fc5b2910e388a63ad33fba06559024fceb1 (diff) | |
download | perl-08e4a1ef4d8dab2b623fc6d1bdad38d849b7d04f.tar.gz |
utf8.h: Simplify UNICODE_IS_SURROGATE()
This uses inRANGE() with mnemonics to make it clearer with no increase
in the number of conditionals
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -950,10 +950,9 @@ Evaluates to 0xFFFD, the code point of the Unicode REPLACEMENT CHARACTER #define UNICODE_ALLOW_SUPER 0 #define UNICODE_ALLOW_ANY 0 -/* This matches the 2048 code points between UNICODE_SURROGATE_FIRST (0xD800) and - * UNICODE_SURROGATE_LAST (0xDFFF) */ -#define UNICODE_IS_SURROGATE(uv) UNLIKELY(((UV) (uv) & (~0xFFFF | 0xF800)) \ - == 0xD800) +/* This matches the 2048 code points between these */ +#define UNICODE_IS_SURROGATE(uv) UNLIKELY(inRANGE(uv, UNICODE_SURROGATE_FIRST, \ + UNICODE_SURROGATE_LAST)) #define UNICODE_IS_REPLACEMENT(uv) UNLIKELY((UV) (uv) == UNICODE_REPLACEMENT) #define UNICODE_IS_BYTE_ORDER_MARK(uv) UNLIKELY((UV) (uv) \ |