From d6f612fac800c31989c298b5101845baed2297b1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 Oct 2017 16:32:12 -0700 Subject: [PATCH] [bsearch] Micro-optimization --- src/hb-open-type-private.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index bed5eea2e..f25341a8a 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -1047,11 +1047,12 @@ struct SortedArrayOf : ArrayOf inline int bsearch (const SearchType &x) const { /* Hand-coded bsearch here since this is in the hot inner loop. */ + const Type *array = this->array; int min = 0, max = (int) this->len - 1; while (min <= max) { int mid = (min + max) / 2; - int c = this->array[mid].cmp (x); + int c = array[mid].cmp (x); if (c < 0) max = mid - 1; else if (c > 0)