// Writes out page values to the array p. Returns the number of values // written. At most size codepoints will be written. unsignedint write (uint32_t base, unsignedint start_value,
hb_codepoint_t *p, unsignedint size) const
{ unsignedint start_v = start_value / ELT_BITS; unsignedint start_bit = start_value & ELT_MASK; unsignedint count = 0; for (unsigned i = start_v; i < len () && count < size; i++)
{
elt_t bits = v[i];
uint32_t v_base = base | (i * ELT_BITS); for (unsignedint j = start_bit; j < ELT_BITS && count < size; j++)
{ if ((elt_t(1) << j) & bits) {
*p++ = v_base | j;
count++;
}
}
start_bit = 0;
} return count;
}
// Writes out the values NOT in this page to the array p. Returns the // number of values written. At most size codepoints will be written. // Returns the number of codepoints written. next_value holds the next value // that should be written (if not present in this page). This is used to fill // any missing value gaps between this page and the previous page, if any. // next_value is updated to one more than the last value present in this page. unsignedint write_inverted (uint32_t base, unsignedint start_value,
hb_codepoint_t *p, unsignedint size,
hb_codepoint_t *next_value) const
{ unsignedint start_v = start_value / ELT_BITS; unsignedint start_bit = start_value & ELT_MASK; unsignedint count = 0; for (unsigned i = start_v; i < len () && count < size; i++)
{
elt_t bits = v[i];
uint32_t v_offset = i * ELT_BITS; for (unsignedint j = start_bit; j < ELT_BITS && count < size; j++)
{ if ((elt_t(1) << j) & bits)
{
hb_codepoint_t value = base | v_offset | j; // Emit all the missing values from next_value up to value - 1. for (hb_codepoint_t k = *next_value; k < value && count < size; k++)
{
*p++ = k;
count++;
} // Skip over this value;
*next_value = value + 1;
}
}
start_bit = 0;
} return count;
}
booloperator == (const hb_bit_page_t &other) const { return is_equal (other); } bool is_equal (const hb_bit_page_t &other) const { return v == other.v; } bool intersects (const hb_bit_page_t &other) const
{ for (unsigned i = 0; i < len (); i++) if (v[i] & other.v[i]) returntrue; returnfalse;
} bool may_intersect (const hb_bit_page_t &other) const
{ return intersects (other); }
for (unsigned i = 0; i < len (); i++) if (~larger_page.v[i] & v[i]) returnfalse; returntrue;
}
bool has_population () const { return population != UINT_MAX; } unsigned get_population () const
{ if (has_population ()) return population; return population = v;
}
bool next (hb_codepoint_t *codepoint) const
{ unsignedint m = (*codepoint + 1) & MASK; if (!m)
{
*codepoint = INVALID; returnfalse;
} unsignedint i = m / ELT_BITS; unsignedint j = m & ELT_MASK;
const elt_t vv = v[i] & ~((elt_t (1) << j) - 1); for (const elt_t *p = &vv; i < len (); p = ((const elt_t *) &v[0]) + (++i)) if (*p)
{
*codepoint = i * ELT_BITS + elt_get_min (*p); returntrue;
}
*codepoint = INVALID; returnfalse;
} bool previous (hb_codepoint_t *codepoint) const
{ unsignedint m = (*codepoint - 1) & MASK; if (m == MASK)
{
*codepoint = INVALID; returnfalse;
} unsignedint i = m / ELT_BITS; unsignedint j = m & ELT_MASK;
/* Fancy mask to avoid shifting by elt_t bitsize, which is undefined. */ const elt_t mask = j < 8 * sizeof (elt_t) - 1 ?
((elt_t (1) << (j + 1)) - 1) :
(elt_t) -1; const elt_t vv = v[i] & mask; const elt_t *p = &vv; while (true)
{ if (*p)
{
*codepoint = i * ELT_BITS + elt_get_max (*p); returntrue;
} if ((int) i <= 0) break;
p = &v[--i];
}
*codepoint = INVALID; returnfalse;
}
hb_codepoint_t get_min () const
{ for (unsignedint i = 0; i < len (); i++) if (v[i]) return i * ELT_BITS + elt_get_min (v[i]); return INVALID;
}
hb_codepoint_t get_max () const
{ for (int i = len () - 1; i >= 0; i--) if (v[i]) return i * ELT_BITS + elt_get_max (v[i]); return0;
}
/* *Iteratorimplementation.
*/ struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t>
{ static constexpr bool is_sorted_iterator = true;
iter_t (const hb_bit_page_t &s_ = Null (hb_bit_page_t), bool init = true) : s (&s_), v (INVALID)
{ if (init)
v = s->get_min ();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.