summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-09-02 13:09:48 -0600
committerKarl Williamson <public@khwilliamson.com>2012-09-13 21:14:01 -0600
commite021c6e6e7e20352e84d2f2a578c324b8d0b490c (patch)
tree72bf4260fe4c9e8798ad2f7efa35d76601a01dd6 /utf8.h
parentbb88be5fd5ba24c1df8fcf9754c8428ea037c246 (diff)
downloadperl-e021c6e6e7e20352e84d2f2a578c324b8d0b490c.tar.gz
utf8.h: Save a branch in a macro
By adding a mask, we can save a branch. The two expressions match the exact same code points.
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/utf8.h b/utf8.h
index 2de54a714b..e312d87608 100644
--- a/utf8.h
+++ b/utf8.h
@@ -164,7 +164,7 @@ Perl's extended UTF-8 means we can have start bytes up to FF.
#define UNI_IS_INVARIANT(c) (((UV)c) < 0x80)
#define UTF8_IS_START(c) (((U8)c) >= 0xc2)
-#define UTF8_IS_CONTINUATION(c) (((U8)c) >= 0x80 && (((U8)c) <= 0xbf))
+#define UTF8_IS_CONTINUATION(c) ((((U8)c) & 0xC0) == 0x80)
#define UTF8_IS_CONTINUED(c) (((U8)c) & 0x80)
/* Masking with 0xfe allows low bit to be 0 or 1; thus this matches 0xc[23] */