From 3f299deb6da6267283a7ad02fa4572c6583eb170 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 6 May 2016 03:01:10 -0400 Subject: bail out quickly here this way, BMP characters (which will be the vast, vast majority) spend very little time checking, rather than having to do a full binary search --- src/unicode-extra.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unicode-extra.c b/src/unicode-extra.c index b226e30..c776f8b 100644 --- a/src/unicode-extra.c +++ b/src/unicode-extra.c @@ -77,6 +77,10 @@ static int vt100_is_wide_emoji(uint32_t codepoint) static size_t ranges = sizeof(vt100_wide_emoji) / sizeof(struct vt100_char_range); ssize_t low = 0, high = ranges - 1; + if (codepoint < vt100_wide_emoji[0].start) { + return 0; + } + do { ssize_t cur = (high + low) / 2; struct vt100_char_range range = vt100_wide_emoji[cur]; -- cgit v1.2.3