[HarfBuzz] harfbuzz: Branch 'master' - 3 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Oct 23 12:38:06 UTC 2017


 src/hb-private.hh     |    2 +-
 src/hb-set-private.hh |   20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 2ee710e02fad1a8a4b94589bb6f0b90e2aeb7121
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Oct 23 08:37:48 2017 -0400

    Minor

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 3d617e2a..b139ed67 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -340,7 +340,7 @@ _hb_popcount64 (uint64_t mask)
   if (sizeof (long) >= sizeof (mask))
     return __builtin_popcountl (mask);
 #endif
-  return _hb_popcount32 (mask) + _hb_popcount32 (mask >> 32);
+  return _hb_popcount32 (mask & 0xFFFFFFFF) + _hb_popcount32 (mask >> 32);
 }
 template <typename T> static inline unsigned int _hb_popcount (T mask);
 template <> inline unsigned int _hb_popcount<uint32_t> (uint32_t mask) { return _hb_popcount32 (mask); }
commit dd33e4e96b9345a6b1a9051a6aa4b7d114c74f1e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Oct 23 08:36:40 2017 -0400

    [set] Don't use major()
    
    Fixes https://github.com/behdad/harfbuzz/issues/577

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index cca4d3f9..de34d172 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -361,7 +361,7 @@ struct hb_set_t
       return *codepoint != INVALID;
     }
 
-    page_map_t map = {major (*codepoint), 0};
+    page_map_t map = {get_major (*codepoint), 0};
     unsigned int i;
     page_map.bfind (&map, &i);
     if (i < page_map.len)
@@ -432,7 +432,7 @@ struct hb_set_t
 
   page_t *page_for_insert (hb_codepoint_t g)
   {
-    page_map_t map = {major (g), pages.len};
+    page_map_t map = {get_major (g), pages.len};
     unsigned int i;
     if (!page_map.bfind (&map, &i))
     {
@@ -447,7 +447,7 @@ struct hb_set_t
   }
   page_t *page_for (hb_codepoint_t g)
   {
-    page_map_t key = {major (g)};
+    page_map_t key = {get_major (g)};
     const page_map_t *found = page_map.bsearch (&key);
     if (found)
       return &pages[found->index];
@@ -455,7 +455,7 @@ struct hb_set_t
   }
   const page_t *page_for (hb_codepoint_t g) const
   {
-    page_map_t key = {major (g)};
+    page_map_t key = {get_major (g)};
     const page_map_t *found = page_map.bsearch (&key);
     if (found)
       return &pages[found->index];
@@ -463,7 +463,7 @@ struct hb_set_t
   }
   page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
   const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
-  unsigned int major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
+  unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
 };
 
 
commit d0f0ff85b9fe959ef4b90f8daf58be73fca49dd0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Oct 23 08:34:30 2017 -0400

    [set] Don't use PAGE_SIZE
    
    Fixes https://github.com/behdad/harfbuzz/issues/576

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 9e0c11e1..cca4d3f9 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -156,6 +156,7 @@ struct hb_set_t
     elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }
     elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & ELT_MASK); }
   };
+  static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8, "");
 
   hb_object_header_t header;
   ASSERT_POD ();
@@ -367,7 +368,7 @@ struct hb_set_t
     {
       if (pages[page_map[i].index].next (codepoint))
       {
-	*codepoint += page_map[i].major * PAGE_SIZE;
+	*codepoint += page_map[i].major * page_t::PAGE_BITS;
         return true;
       }
       i++;
@@ -377,7 +378,7 @@ struct hb_set_t
       hb_codepoint_t m = pages[page_map[i].index].get_min ();
       if (m != INVALID)
       {
-	*codepoint = page_map[i].major * PAGE_SIZE + m;
+	*codepoint = page_map[i].major * page_t::PAGE_BITS + m;
 	return true;
       }
     }
@@ -415,7 +416,7 @@ struct hb_set_t
     unsigned int count = pages.len;
     for (unsigned int i = 0; i < count; i++)
       if (!page_at (i).is_empty ())
-        return page_map[i].major * PAGE_SIZE + page_at (i).get_min ();
+        return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min ();
     return INVALID;
   }
   inline hb_codepoint_t get_max (void) const
@@ -423,11 +424,10 @@ struct hb_set_t
     unsigned int count = pages.len;
     for (int i = count - 1; i >= 0; i++)
       if (!page_at (i).is_empty ())
-        return page_map[i].major * PAGE_SIZE + page_at (i).get_max ();
+        return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_max ();
     return INVALID;
   }
 
-  static const unsigned int PAGE_SIZE = sizeof (page_t) * 8;
   static  const hb_codepoint_t INVALID = HB_SET_VALUE_INVALID;
 
   page_t *page_for_insert (hb_codepoint_t g)
@@ -463,7 +463,7 @@ struct hb_set_t
   }
   page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
   const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
-  unsigned int major (hb_codepoint_t g) const { return g / PAGE_SIZE; }
+  unsigned int major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
 };
 
 


More information about the HarfBuzz mailing list