summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2023-02-12 04:02:23 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2023-02-12 04:02:23 +0000
commit68b944ccd2bbecda0f13fbc7f89940651052fb5d (patch)
tree5b6eb646bd02c0121c23f03038d98efb4e3978f8 /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh
parent95839e60a0c4b132fff96a310d15366cddf02a64 (diff)
harfbuzz 7.0.0
git-svn-id: svn://tug.org/texlive/trunk@65798 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh18
1 files changed, 11 insertions, 7 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh
index 8de6e037fbd..475b07b810b 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bit-set.hh
@@ -38,7 +38,7 @@ struct hb_bit_set_t
hb_bit_set_t () = default;
~hb_bit_set_t () = default;
- hb_bit_set_t (const hb_bit_set_t& other) : hb_bit_set_t () { set (other); }
+ hb_bit_set_t (const hb_bit_set_t& other) : hb_bit_set_t () { set (other, true); }
hb_bit_set_t ( hb_bit_set_t&& other) : hb_bit_set_t () { hb_swap (*this, other); }
hb_bit_set_t& operator= (const hb_bit_set_t& other) { set (other); return *this; }
hb_bit_set_t& operator= (hb_bit_set_t&& other) { hb_swap (*this, other); return *this; }
@@ -85,12 +85,16 @@ struct hb_bit_set_t
void err () { if (successful) successful = false; } /* TODO Remove */
bool in_error () const { return !successful; }
- bool resize (unsigned int count, bool clear = true)
+ bool resize (unsigned int count, bool clear = true, bool exact_size = false)
{
if (unlikely (!successful)) return false;
- if (unlikely (!pages.resize (count, clear) || !page_map.resize (count, clear)))
+
+ if (pages.length == 0 && count == 1)
+ exact_size = true; // Most sets are small and local
+
+ if (unlikely (!pages.resize (count, clear, exact_size) || !page_map.resize (count, clear, exact_size)))
{
- pages.resize (page_map.length);
+ pages.resize (page_map.length, clear, exact_size);
successful = false;
return false;
}
@@ -346,11 +350,11 @@ struct hb_bit_set_t
hb_codepoint_t c = first - 1;
return next (&c) && c <= last;
}
- void set (const hb_bit_set_t &other)
+ void set (const hb_bit_set_t &other, bool exact_size = false)
{
if (unlikely (!successful)) return;
unsigned int count = other.pages.length;
- if (unlikely (!resize (count, false)))
+ if (unlikely (!resize (count, false, exact_size)))
return;
population = other.population;
@@ -422,7 +426,7 @@ struct hb_bit_set_t
private:
bool allocate_compact_workspace (hb_vector_t<unsigned>& workspace)
{
- if (unlikely (!workspace.resize (pages.length)))
+ if (unlikely (!workspace.resize_exact (pages.length)))
{
successful = false;
return false;