Obssesive optimization
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 18 Apr 2013 03:04:03 +0000 (23:04 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 18 Apr 2013 03:04:03 +0000 (23:04 -0400)
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
src/hb-ot-layout-gsub-table.hh

index 4413927..b2b5e9a 100644 (file)
@@ -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
index 35d0729..5247c68 100644 (file)
@@ -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