mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-12-01 02:23:59 +01:00
[bit-page] Micro-optimize
This commit is contained in:
1 parent
0a678a9233
commit
a4cd11dea9
1 file changed
+7
-8
+7
-8
@@ -103,10 +103,10 @@ struct hb_bit_page_t
|
||||
bool is_empty () const
|
||||
{
|
||||
if (has_population ()) return !population;
|
||||
return
|
||||
+ hb_iter (v)
|
||||
| hb_none
|
||||
;
|
||||
for (unsigned i = 0; i < len (); i++)
|
||||
if (v[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
uint32_t hash () const
|
||||
{
|
||||
@@ -260,10 +260,9 @@ struct hb_bit_page_t
|
||||
unsigned int get_population () const
|
||||
{
|
||||
if (has_population ()) return population;
|
||||
population =
|
||||
+ hb_iter (v)
|
||||
| hb_reduce ([] (unsigned pop, const elt_t &_) { return pop + hb_popcount (_); }, 0u)
|
||||
;
|
||||
population = 0;
|
||||
for (unsigned i = 0; i < len (); i++)
|
||||
population += hb_popcount (v[i]);
|
||||
return population;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user