From 0dc3a4e0349d28f387a3b4c60a2f51962742738e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 17 Apr 2013 23:04:03 -0400 Subject: [PATCH] Obssesive optimization Not measurable by any means, but conceptually this is faster since the mask matches more often than the digest. --- src/hb-ot-layout-gpos-table.hh | 4 ++-- src/hb-ot-layout-gsub-table.hh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 4413927..b2b5e9a 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1480,8 +1480,8 @@ struct PosLookup : Lookup while (c->buffer->idx < c->buffer->len) { - if ((c->buffer->cur().mask & c->lookup_mask) && - digest->may_have (c->buffer->cur().codepoint) && + if (digest->may_have (c->buffer->cur().codepoint) && + (c->buffer->cur().mask & c->lookup_mask) && apply_once (c)) ret = true; else diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 35d0729..5247c68 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1202,8 +1202,8 @@ struct SubstLookup : Lookup while (c->buffer->idx < c->buffer->len) { - if ((c->buffer->cur().mask & c->lookup_mask) && - digest->may_have (c->buffer->cur().codepoint) && + if (digest->may_have (c->buffer->cur().codepoint) && + (c->buffer->cur().mask & c->lookup_mask) && apply_once (c)) ret = true; else @@ -1219,8 +1219,8 @@ struct SubstLookup : Lookup c->buffer->idx = c->buffer->len - 1; do { - if ((c->buffer->cur().mask & c->lookup_mask) && - digest->may_have (c->buffer->cur().codepoint) && + if (digest->may_have (c->buffer->cur().codepoint) && + (c->buffer->cur().mask & c->lookup_mask) && apply_once (c)) ret = true; else -- 2.7.4