/src/harfbuzz/src/hb-map.hh
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright © 2018 Google, Inc. |
3 | | * |
4 | | * This is part of HarfBuzz, a text shaping library. |
5 | | * |
6 | | * Permission is hereby granted, without written agreement and without |
7 | | * license or royalty fees, to use, copy, modify, and distribute this |
8 | | * software and its documentation for any purpose, provided that the |
9 | | * above copyright notice and the following two paragraphs appear in |
10 | | * all copies of this software. |
11 | | * |
12 | | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
13 | | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
14 | | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
15 | | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
16 | | * DAMAGE. |
17 | | * |
18 | | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
19 | | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
20 | | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
21 | | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
22 | | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
23 | | * |
24 | | * Google Author(s): Behdad Esfahbod |
25 | | */ |
26 | | |
27 | | #ifndef HB_MAP_HH |
28 | | #define HB_MAP_HH |
29 | | |
30 | | #include "hb.hh" |
31 | | |
32 | | #include "hb-set.hh" |
33 | | |
34 | | |
35 | | /* |
36 | | * hb_hashmap_t |
37 | | */ |
38 | | |
39 | | extern HB_INTERNAL const hb_codepoint_t minus_1; |
40 | | |
41 | | template <typename K, typename V, |
42 | | bool minus_one = false> |
43 | | struct hb_hashmap_t |
44 | | { |
45 | | static constexpr bool realloc_move = true; |
46 | | |
47 | 5.39k | hb_hashmap_t () { init (); } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::hb_hashmap_t() hb_hashmap_t<unsigned int, unsigned int, true>::hb_hashmap_t() Line | Count | Source | 47 | 5.39k | hb_hashmap_t () { init (); } |
Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::hb_hashmap_t() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::hb_hashmap_t() |
48 | 5.39k | ~hb_hashmap_t () { fini (); } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::~hb_hashmap_t() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::~hb_hashmap_t() hb_hashmap_t<unsigned int, unsigned int, true>::~hb_hashmap_t() Line | Count | Source | 48 | 5.39k | ~hb_hashmap_t () { fini (); } |
Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::~hb_hashmap_t() |
49 | | |
50 | | hb_hashmap_t (const hb_hashmap_t& o) : hb_hashmap_t () |
51 | | { |
52 | | if (unlikely (!o.mask)) return; |
53 | | |
54 | | if (item_t::is_trivial) |
55 | | { |
56 | | items = (item_t *) hb_malloc (sizeof (item_t) * (o.mask + 1)); |
57 | | if (unlikely (!items)) |
58 | | { |
59 | | successful = false; |
60 | | return; |
61 | | } |
62 | | population = o.population; |
63 | | occupancy = o.occupancy; |
64 | | mask = o.mask; |
65 | | prime = o.prime; |
66 | | max_chain_length = o.max_chain_length; |
67 | | memcpy (items, o.items, sizeof (item_t) * (mask + 1)); |
68 | | return; |
69 | | } |
70 | | |
71 | | alloc (o.population); hb_copy (o, *this); |
72 | | } |
73 | | hb_hashmap_t (hb_hashmap_t&& o) noexcept : hb_hashmap_t () { hb_swap (*this, o); } |
74 | 0 | hb_hashmap_t& operator= (const hb_hashmap_t& o) { reset (); alloc (o.population); hb_copy (o, *this); return *this; } |
75 | 0 | hb_hashmap_t& operator= (hb_hashmap_t&& o) noexcept { hb_swap (*this, o); return *this; } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::operator=(hb_hashmap_t<unsigned int, unsigned int, true>&&) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<bool, false> const*, hb_vector_t<unsigned char, false>, false>::operator=(hb_hashmap_t<hb_vector_t<bool, false> const*, hb_vector_t<unsigned char, false>, false>&&) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<bool, false> const*, unsigned int, false>::operator=(hb_hashmap_t<hb_vector_t<bool, false> const*, unsigned int, false>&&) |
76 | | |
77 | | hb_hashmap_t (std::initializer_list<hb_pair_t<K, V>> lst) : hb_hashmap_t () |
78 | | { |
79 | | for (auto&& item : lst) |
80 | | set (item.first, item.second); |
81 | | } |
82 | | template <typename Iterable, |
83 | | hb_requires (hb_is_iterable (Iterable))> |
84 | | hb_hashmap_t (const Iterable &o) : hb_hashmap_t () |
85 | | { |
86 | | auto iter = hb_iter (o); |
87 | | if (iter.is_random_access_iterator || iter.has_fast_len) |
88 | | alloc (hb_len (iter)); |
89 | | hb_copy (iter, *this); |
90 | | } |
91 | | |
92 | | struct item_t |
93 | | { |
94 | | K key; |
95 | | uint32_t is_real_ : 1; |
96 | | uint32_t is_used_ : 1; |
97 | | uint32_t hash : 30; |
98 | | V value; |
99 | | |
100 | | item_t () : key (), |
101 | 0 | is_real_ (false), is_used_ (false), |
102 | 0 | hash (0), |
103 | 0 | value () {} Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::item_t::item_t() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::item_t::item_t() |
104 | | |
105 | | // Needed for https://github.com/harfbuzz/harfbuzz/issues/4138 |
106 | 0 | K& get_key () { return key; } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::item_t::get_key() Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::get_key() Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::get_key() |
107 | 0 | V& get_value () { return value; } Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::item_t::get_value() Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::item_t::get_value() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::get_value() Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::get_value() |
108 | | |
109 | 130k | bool is_used () const { return is_used_; } hb_hashmap_t<unsigned int, unsigned int, true>::item_t::is_used() const Line | Count | Source | 109 | 130k | bool is_used () const { return is_used_; } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, TripleDistances, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<void const*, void const*>, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<char, false> const*, unsigned int, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::is_used() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::item_t::is_used() const |
110 | 306 | void set_used (bool is_used) { is_used_ = is_used; } hb_hashmap_t<unsigned int, unsigned int, true>::item_t::set_used(bool) Line | Count | Source | 110 | 306 | void set_used (bool is_used) { is_used_ = is_used; } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::set_used(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::item_t::set_used(bool) |
111 | 306 | void set_real (bool is_real) { is_real_ = is_real; } hb_hashmap_t<unsigned int, unsigned int, true>::item_t::set_real(bool) Line | Count | Source | 111 | 306 | void set_real (bool is_real) { is_real_ = is_real; } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::set_real(bool) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::item_t::set_real(bool) |
112 | 160 | bool is_real () const { return is_real_; } hb_hashmap_t<unsigned int, unsigned int, true>::item_t::is_real() const Line | Count | Source | 112 | 160 | bool is_real () const { return is_real_; } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, TripleDistances, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<void const*, void const*>, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<char, false> const*, unsigned int, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::is_real() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::item_t::is_real() const |
113 | | |
114 | | template <bool v = minus_one, |
115 | | hb_enable_if (v == false)> |
116 | 0 | static inline const V& default_value () { return Null(V); }; Unexecuted instantiation: _ZN12hb_hashmap_tIPKN22hb_serialize_context_t8object_tEjLb0EE6item_t13default_valueILb0ETnPN12hb_enable_ifIXeqT_Lb0EEvE4typeELPv0EEERKjv Unexecuted instantiation: _ZN12hb_hashmap_tIjN2hb10unique_ptrI8hb_set_tEELb0EE6item_t13default_valueILb0ETnPN12hb_enable_ifIXeqT_Lb0EEvE4typeELPv0EEERKS3_v Unexecuted instantiation: _ZN12hb_hashmap_tIjN2hb10shared_ptrI8hb_set_tEELb0EE6item_t13default_valueILb0ETnPN12hb_enable_ifIXeqT_Lb0EEvE4typeELPv0EEERKS3_v Unexecuted instantiation: _ZN12hb_hashmap_tIj15TripleDistancesLb0EE6item_t13default_valueILb0ETnPN12hb_enable_ifIXeqT_Lb0EEvE4typeELPv0EEERKS0_v Unexecuted instantiation: _ZN12hb_hashmap_tIj6TripleLb0EE6item_t13default_valueILb0ETnPN12hb_enable_ifIXeqT_Lb0EEvE4typeELPv0EEERKS0_v Unexecuted instantiation: _ZN12hb_hashmap_tIj17face_table_info_tLb0EE6item_t13default_valueILb0ETnPN12hb_enable_ifIXeqT_Lb0EEvE4typeELPv0EEERKS0_v |
117 | | template <bool v = minus_one, |
118 | | hb_enable_if (v == true)> |
119 | | static inline const V& default_value () |
120 | 0 | { |
121 | 0 | static_assert (hb_is_same (V, hb_codepoint_t), ""); |
122 | 0 | return minus_1; |
123 | 0 | }; |
124 | | |
125 | 637 | bool operator == (const K &o) const { return hb_deref (key) == hb_deref (o); } hb_hashmap_t<unsigned int, unsigned int, true>::item_t::operator==(unsigned int const&) const Line | Count | Source | 125 | 637 | bool operator == (const K &o) const { return hb_deref (key) == hb_deref (o); } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::item_t::operator==(hb_serialize_context_t::object_t const* const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, TripleDistances, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::item_t::operator==(hb::shared_ptr<hb_map_t> const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<void const*, void const*>, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<char, false> const*, unsigned int, false>::item_t::operator==(hb_vector_t<char, false> const* const&) const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::item_t::operator==(hb_hashmap_t<unsigned int, Triple, false> const* const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::item_t::operator==(hb_vector_t<int, false> const* const&) const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::item_t::operator==(hb_vector_t<unsigned char, false> const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::operator==(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::item_t::operator==(unsigned int const&) const |
126 | | bool operator == (const item_t &o) const { return *this == o.key; } |
127 | 0 | hb_pair_t<K, V> get_pair() const { return hb_pair_t<K, V> (key, value); } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::item_t::get_pair() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::get_pair() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::item_t::get_pair() const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::item_t::get_pair() const |
128 | 0 | hb_pair_t<const K &, V &> get_pair_ref() { return hb_pair_t<const K &, V &> (key, value); } Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::item_t::get_pair_ref() Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::item_t::get_pair_ref() |
129 | | |
130 | | uint32_t total_hash () const |
131 | 0 | { return (hash * 31u) + hb_hash (value); } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::item_t::total_hash() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::item_t::total_hash() const |
132 | | |
133 | | static constexpr bool is_trivial = hb_is_trivially_constructible(K) && |
134 | | hb_is_trivially_destructible(K) && |
135 | | hb_is_trivially_constructible(V) && |
136 | | hb_is_trivially_destructible(V); |
137 | | }; |
138 | | |
139 | | hb_object_header_t header; |
140 | | bool successful; /* Allocations successful */ |
141 | | unsigned short max_chain_length; |
142 | | unsigned int population; /* Not including tombstones. */ |
143 | | unsigned int occupancy; /* Including tombstones. */ |
144 | | unsigned int mask; |
145 | | unsigned int prime; |
146 | | item_t *items; |
147 | | |
148 | | friend void swap (hb_hashmap_t& a, hb_hashmap_t& b) noexcept |
149 | 0 | { |
150 | 0 | if (unlikely (!a.successful || !b.successful)) |
151 | 0 | return; |
152 | 0 | hb_swap (a.max_chain_length, b.max_chain_length); |
153 | 0 | hb_swap (a.population, b.population); |
154 | 0 | hb_swap (a.occupancy, b.occupancy); |
155 | 0 | hb_swap (a.mask, b.mask); |
156 | 0 | hb_swap (a.prime, b.prime); |
157 | 0 | hb_swap (a.items, b.items); |
158 | 0 | } Unexecuted instantiation: swap(hb_hashmap_t<unsigned int, unsigned int, true>&, hb_hashmap_t<unsigned int, unsigned int, true>&) Unexecuted instantiation: swap(hb_hashmap_t<unsigned int, Triple, false>&, hb_hashmap_t<unsigned int, Triple, false>&) Unexecuted instantiation: swap(hb_hashmap_t<hb_vector_t<bool, false> const*, hb_vector_t<unsigned char, false>, false>&, hb_hashmap_t<hb_vector_t<bool, false> const*, hb_vector_t<unsigned char, false>, false>&) Unexecuted instantiation: swap(hb_hashmap_t<hb_vector_t<bool, false> const*, unsigned int, false>&, hb_hashmap_t<hb_vector_t<bool, false> const*, unsigned int, false>&) |
159 | | void init () |
160 | 5.39k | { |
161 | 5.39k | hb_object_init (this); |
162 | | |
163 | 5.39k | successful = true; |
164 | 5.39k | max_chain_length = 0; |
165 | 5.39k | population = occupancy = 0; |
166 | 5.39k | mask = 0; |
167 | 5.39k | prime = 0; |
168 | 5.39k | items = nullptr; |
169 | 5.39k | } hb_hashmap_t<unsigned int, unsigned int, true>::init() Line | Count | Source | 160 | 5.39k | { | 161 | 5.39k | hb_object_init (this); | 162 | | | 163 | 5.39k | successful = true; | 164 | 5.39k | max_chain_length = 0; | 165 | 5.39k | population = occupancy = 0; | 166 | 5.39k | mask = 0; | 167 | 5.39k | prime = 0; | 168 | 5.39k | items = nullptr; | 169 | 5.39k | } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_blob_t>, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::init() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<bool, false> const*, hb_vector_t<unsigned char, false>, false>::init() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<bool, false> const*, unsigned int, false>::init() Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::init() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::init() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::init() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::init() |
170 | | void fini () |
171 | 5.39k | { |
172 | 5.39k | hb_object_fini (this); |
173 | | |
174 | 5.39k | if (likely (items)) |
175 | 5.39k | { |
176 | 5.39k | unsigned size = mask + 1; |
177 | 5.39k | if (!item_t::is_trivial) |
178 | 0 | for (unsigned i = 0; i < size; i++) |
179 | 0 | items[i].~item_t (); |
180 | 5.39k | hb_free (items); |
181 | 5.39k | items = nullptr; |
182 | 5.39k | } |
183 | 5.39k | population = occupancy = 0; |
184 | 5.39k | } hb_hashmap_t<unsigned int, unsigned int, true>::fini() Line | Count | Source | 171 | 5.39k | { | 172 | 5.39k | hb_object_fini (this); | 173 | | | 174 | 5.39k | if (likely (items)) | 175 | 5.39k | { | 176 | 5.39k | unsigned size = mask + 1; | 177 | 5.39k | if (!item_t::is_trivial) | 178 | 0 | for (unsigned i = 0; i < size; i++) | 179 | 0 | items[i].~item_t (); | 180 | 5.39k | hb_free (items); | 181 | 5.39k | items = nullptr; | 182 | 5.39k | } | 183 | 5.39k | population = occupancy = 0; | 184 | 5.39k | } |
Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_blob_t>, false>::fini() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<bool, false> const*, hb_vector_t<unsigned char, false>, false>::fini() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<bool, false> const*, unsigned int, false>::fini() Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::fini() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::fini() Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::fini() Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::fini() |
185 | | |
186 | | void reset () |
187 | 0 | { |
188 | 0 | successful = true; |
189 | 0 | clear (); |
190 | 0 | } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::reset() Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::reset() |
191 | | |
192 | 0 | bool in_error () const { return !successful; } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::in_error() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::in_error() const Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::in_error() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::in_error() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_blob_t>, false>::in_error() const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::in_error() const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::in_error() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::in_error() const |
193 | | |
194 | | bool alloc (unsigned new_population = 0) |
195 | 5.39k | { |
196 | 5.39k | if (unlikely (!successful)) return false; |
197 | | |
198 | 5.39k | if (new_population != 0 && (new_population + new_population / 2) < mask) return true; |
199 | | |
200 | 5.39k | unsigned int power = hb_bit_storage (hb_max ((unsigned) population, new_population) * 2 + 8); |
201 | 5.39k | unsigned int new_size = 1u << power; |
202 | 5.39k | item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t)); |
203 | 5.39k | if (unlikely (!new_items)) |
204 | 0 | { |
205 | 0 | successful = false; |
206 | 0 | return false; |
207 | 0 | } |
208 | 5.39k | if (!item_t::is_trivial) |
209 | 0 | for (auto &_ : hb_iter (new_items, new_size)) |
210 | 0 | new (&_) item_t (); |
211 | 5.39k | else |
212 | 5.39k | hb_memset (new_items, 0, (size_t) new_size * sizeof (item_t)); |
213 | | |
214 | 5.39k | unsigned int old_size = size (); |
215 | 5.39k | item_t *old_items = items; |
216 | | |
217 | | /* Switch to new, empty, array. */ |
218 | 5.39k | population = occupancy = 0; |
219 | 5.39k | mask = new_size - 1; |
220 | 5.39k | prime = prime_for (power); |
221 | 5.39k | max_chain_length = power * 2; |
222 | 5.39k | items = new_items; |
223 | | |
224 | | /* Insert back old items. */ |
225 | 5.39k | for (unsigned int i = 0; i < old_size; i++) |
226 | 0 | { |
227 | 0 | if (old_items[i].is_real ()) |
228 | 0 | { |
229 | 0 | set_with_hash (std::move (old_items[i].key), |
230 | 0 | old_items[i].hash, |
231 | 0 | std::move (old_items[i].value)); |
232 | 0 | } |
233 | 0 | } |
234 | 5.39k | if (!item_t::is_trivial) |
235 | 0 | for (unsigned int i = 0; i < old_size; i++) |
236 | 0 | old_items[i].~item_t (); |
237 | | |
238 | 5.39k | hb_free (old_items); |
239 | | |
240 | 5.39k | return true; |
241 | 5.39k | } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::alloc(unsigned int) hb_hashmap_t<unsigned int, unsigned int, true>::alloc(unsigned int) Line | Count | Source | 195 | 5.39k | { | 196 | 5.39k | if (unlikely (!successful)) return false; | 197 | | | 198 | 5.39k | if (new_population != 0 && (new_population + new_population / 2) < mask) return true; | 199 | | | 200 | 5.39k | unsigned int power = hb_bit_storage (hb_max ((unsigned) population, new_population) * 2 + 8); | 201 | 5.39k | unsigned int new_size = 1u << power; | 202 | 5.39k | item_t *new_items = (item_t *) hb_malloc ((size_t) new_size * sizeof (item_t)); | 203 | 5.39k | if (unlikely (!new_items)) | 204 | 0 | { | 205 | 0 | successful = false; | 206 | 0 | return false; | 207 | 0 | } | 208 | 5.39k | if (!item_t::is_trivial) | 209 | 0 | for (auto &_ : hb_iter (new_items, new_size)) | 210 | 0 | new (&_) item_t (); | 211 | 5.39k | else | 212 | 5.39k | hb_memset (new_items, 0, (size_t) new_size * sizeof (item_t)); | 213 | | | 214 | 5.39k | unsigned int old_size = size (); | 215 | 5.39k | item_t *old_items = items; | 216 | | | 217 | | /* Switch to new, empty, array. */ | 218 | 5.39k | population = occupancy = 0; | 219 | 5.39k | mask = new_size - 1; | 220 | 5.39k | prime = prime_for (power); | 221 | 5.39k | max_chain_length = power * 2; | 222 | 5.39k | items = new_items; | 223 | | | 224 | | /* Insert back old items. */ | 225 | 5.39k | for (unsigned int i = 0; i < old_size; i++) | 226 | 0 | { | 227 | 0 | if (old_items[i].is_real ()) | 228 | 0 | { | 229 | 0 | set_with_hash (std::move (old_items[i].key), | 230 | 0 | old_items[i].hash, | 231 | 0 | std::move (old_items[i].value)); | 232 | 0 | } | 233 | 0 | } | 234 | 5.39k | if (!item_t::is_trivial) | 235 | 0 | for (unsigned int i = 0; i < old_size; i++) | 236 | 0 | old_items[i].~item_t (); | 237 | | | 238 | 5.39k | hb_free (old_items); | 239 | | | 240 | 5.39k | return true; | 241 | 5.39k | } |
Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::alloc(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::alloc(unsigned int) |
242 | | |
243 | | template <typename KK, typename VV> |
244 | | bool set_with_hash (KK&& key, uint32_t hash, VV&& value, bool overwrite = true) |
245 | 306 | { |
246 | 306 | if (unlikely (!successful)) return false; |
247 | 306 | if (unlikely ((occupancy + occupancy / 2) >= mask && !alloc ())) return false; |
248 | | |
249 | 306 | hash &= 0x3FFFFFFF; // We only store lower 30bit of hash |
250 | 306 | unsigned int tombstone = (unsigned int) -1; |
251 | 306 | unsigned int i = hash % prime; |
252 | 306 | unsigned length = 0; |
253 | 306 | unsigned step = 0; |
254 | 308 | while (items[i].is_used ()) |
255 | 2 | { |
256 | 2 | if ((std::is_integral<K>::value || items[i].hash == hash) && |
257 | 2 | items[i] == key) |
258 | 0 | { |
259 | 0 | if (!overwrite) |
260 | 0 | return false; |
261 | 0 | else |
262 | 0 | break; |
263 | 0 | } |
264 | 2 | if (!items[i].is_real () && tombstone == (unsigned) -1) |
265 | 0 | tombstone = i; |
266 | 2 | i = (i + ++step) & mask; |
267 | 2 | length++; |
268 | 2 | } |
269 | | |
270 | 306 | item_t &item = items[tombstone == (unsigned) -1 ? i : tombstone]; |
271 | | |
272 | 306 | if (item.is_used ()) |
273 | 0 | { |
274 | 0 | occupancy--; |
275 | 0 | population -= item.is_real (); |
276 | 0 | } |
277 | | |
278 | 306 | item.key = std::forward<KK> (key); |
279 | 306 | item.value = std::forward<VV> (value); |
280 | 306 | item.hash = hash; |
281 | 306 | item.set_used (true); |
282 | 306 | item.set_real (true); |
283 | | |
284 | 306 | occupancy++; |
285 | 306 | population++; |
286 | | |
287 | 306 | if (unlikely (length > max_chain_length) && occupancy * 8 > mask) |
288 | 0 | alloc (mask - 8); // This ensures we jump to next larger size |
289 | | |
290 | 306 | return true; |
291 | 306 | } Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int const&, unsigned int const&>(unsigned int const&, unsigned int, unsigned int const&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::set_with_hash<hb_serialize_context_t::object_t*&, unsigned int&>(hb_serialize_context_t::object_t*&, unsigned int, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::set_with_hash<hb_serialize_context_t::object_t const*, unsigned int>(hb_serialize_context_t::object_t const*&&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::set_with_hash<unsigned int const&, hb_vector_t<unsigned int, false> >(unsigned int const&, unsigned int, hb_vector_t<unsigned int, false>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::set_with_hash<unsigned int, hb_vector_t<unsigned int, false> >(unsigned int&&, unsigned int, hb_vector_t<unsigned int, false>&&, bool) bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int const&, unsigned int&>(unsigned int const&, unsigned int, unsigned int&, bool) Line | Count | Source | 245 | 306 | { | 246 | 306 | if (unlikely (!successful)) return false; | 247 | 306 | if (unlikely ((occupancy + occupancy / 2) >= mask && !alloc ())) return false; | 248 | | | 249 | 306 | hash &= 0x3FFFFFFF; // We only store lower 30bit of hash | 250 | 306 | unsigned int tombstone = (unsigned int) -1; | 251 | 306 | unsigned int i = hash % prime; | 252 | 306 | unsigned length = 0; | 253 | 306 | unsigned step = 0; | 254 | 308 | while (items[i].is_used ()) | 255 | 2 | { | 256 | 2 | if ((std::is_integral<K>::value || items[i].hash == hash) && | 257 | 2 | items[i] == key) | 258 | 0 | { | 259 | 0 | if (!overwrite) | 260 | 0 | return false; | 261 | 0 | else | 262 | 0 | break; | 263 | 0 | } | 264 | 2 | if (!items[i].is_real () && tombstone == (unsigned) -1) | 265 | 0 | tombstone = i; | 266 | 2 | i = (i + ++step) & mask; | 267 | 2 | length++; | 268 | 2 | } | 269 | | | 270 | 306 | item_t &item = items[tombstone == (unsigned) -1 ? i : tombstone]; | 271 | | | 272 | 306 | if (item.is_used ()) | 273 | 0 | { | 274 | 0 | occupancy--; | 275 | 0 | population -= item.is_real (); | 276 | 0 | } | 277 | | | 278 | 306 | item.key = std::forward<KK> (key); | 279 | 306 | item.value = std::forward<VV> (value); | 280 | 306 | item.hash = hash; | 281 | 306 | item.set_used (true); | 282 | 306 | item.set_real (true); | 283 | | | 284 | 306 | occupancy++; | 285 | 306 | population++; | 286 | | | 287 | 306 | if (unlikely (length > max_chain_length) && occupancy * 8 > mask) | 288 | 0 | alloc (mask - 8); // This ensures we jump to next larger size | 289 | | | 290 | 306 | return true; | 291 | 306 | } |
Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int, unsigned int>(unsigned int&&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::set_with_hash<unsigned int const&, hb::unique_ptr<hb_set_t> >(unsigned int const&, unsigned int, hb::unique_ptr<hb_set_t>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::set_with_hash<unsigned int, hb::unique_ptr<hb_set_t> >(unsigned int&&, unsigned int, hb::unique_ptr<hb_set_t>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int, int>(unsigned int&&, unsigned int, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set_with_hash<unsigned int const&, Triple>(unsigned int const&, unsigned int, Triple&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set_with_hash<unsigned int, Triple>(unsigned int&&, unsigned int, Triple&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int, unsigned int&>(unsigned int&&, unsigned int, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::set_with_hash<hb::shared_ptr<hb_map_t> const&, int>(hb::shared_ptr<hb_map_t> const&, unsigned int, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::set_with_hash<hb::shared_ptr<hb_map_t>, unsigned int>(hb::shared_ptr<hb_map_t>&&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::set_with_hash<unsigned int const&, hb::shared_ptr<hb_set_t>&>(unsigned int const&, unsigned int, hb::shared_ptr<hb_set_t>&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::set_with_hash<unsigned int, hb::shared_ptr<hb_set_t> >(unsigned int&&, unsigned int, hb::shared_ptr<hb_set_t>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, OT::Feature const*, false>::set_with_hash<unsigned int, OT::Feature const*>(unsigned int&&, unsigned int, OT::Feature const*&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set_with_hash<unsigned int const&, Triple&>(unsigned int const&, unsigned int, Triple&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set_with_hash<unsigned int const&, Triple const&>(unsigned int const&, unsigned int, Triple const&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set_with_hash<hb_hashmap_t<unsigned int, Triple, false> const* const&, int>(hb_hashmap_t<unsigned int, Triple, false> const* const&, unsigned int, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set_with_hash<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int>(hb_hashmap_t<unsigned int, Triple, false> const*&&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set_with_hash<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int&>(hb_hashmap_t<unsigned int, Triple, false> const*&&, unsigned int, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set_with_hash<hb_hashmap_t<unsigned int, Triple, false> const* const&, unsigned int&>(hb_hashmap_t<unsigned int, Triple, false> const* const&, unsigned int, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::set_with_hash<unsigned int, hb_vector_t<int, false> const*>(unsigned int&&, unsigned int, hb_vector_t<int, false> const*&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::set_with_hash<hb_vector_t<int, false> const*, int>(hb_vector_t<int, false> const*&&, unsigned int, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::set_with_hash<hb_vector_t<int, false> const*, unsigned int>(hb_vector_t<int, false> const*&&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::set_with_hash<hb_vector_t<unsigned char, false> const&, unsigned int&>(hb_vector_t<unsigned char, false> const&, unsigned int, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::set_with_hash<hb_vector_t<unsigned char, false>, unsigned int>(hb_vector_t<unsigned char, false>&&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::set_with_hash<hb_vector_t<int, false> const* const&, unsigned int&>(hb_vector_t<int, false> const* const&, unsigned int, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int const&, unsigned int>(unsigned int const&, unsigned int, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, face_table_info_t, false>::set_with_hash<unsigned int const&, face_table_info_t>(unsigned int const&, unsigned int, face_table_info_t&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, face_table_info_t, false>::set_with_hash<unsigned int, face_table_info_t>(unsigned int&&, unsigned int, face_table_info_t&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::set_with_hash<unsigned int&, hb_pair_t<unsigned int, int&> >(unsigned int&, unsigned int, hb_pair_t<unsigned int, int&>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::set_with_hash<unsigned int, hb_pair_t<unsigned int, int> >(unsigned int&&, unsigned int, hb_pair_t<unsigned int, int>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int const&, bool&>(unsigned int const&, unsigned int, bool&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_set_t, false>::set_with_hash<unsigned int const&, hb_set_t>(unsigned int const&, unsigned int, hb_set_t&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_set_t, false>::set_with_hash<unsigned int, hb_set_t>(unsigned int&&, unsigned int, hb_set_t&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set_with_hash<unsigned int const&, OT::OffsetTo<OT::ClipBox, OT::NumType<true, unsigned int, 3u>, void, true> const&>(unsigned int const&, unsigned int, OT::OffsetTo<OT::ClipBox, OT::NumType<true, unsigned int, 3u>, void, true> const&, bool) |
292 | | |
293 | | template <typename VV> |
294 | 306 | bool set (const K &key, VV&& value, bool overwrite = true) { return set_with_hash (key, hb_hash (key), std::forward<VV> (value), overwrite); } Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<unsigned int const&>(unsigned int const&, unsigned int const&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::set<hb_vector_t<unsigned int, false> >(unsigned int const&, hb_vector_t<unsigned int, false>&&, bool) bool hb_hashmap_t<unsigned int, unsigned int, true>::set<unsigned int&>(unsigned int const&, unsigned int&, bool) Line | Count | Source | 294 | 306 | bool set (const K &key, VV&& value, bool overwrite = true) { return set_with_hash (key, hb_hash (key), std::forward<VV> (value), overwrite); } |
Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::set<hb::unique_ptr<hb_set_t> >(unsigned int const&, hb::unique_ptr<hb_set_t>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set<Triple>(unsigned int const&, Triple&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::set<int>(hb::shared_ptr<hb_map_t> const&, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::set<hb::shared_ptr<hb_set_t>&>(unsigned int const&, hb::shared_ptr<hb_set_t>&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set<Triple&>(unsigned int const&, Triple&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::set<Triple const&>(unsigned int const&, Triple const&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set<int>(hb_hashmap_t<unsigned int, Triple, false> const* const&, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set<unsigned int&>(hb_hashmap_t<unsigned int, Triple, false> const* const&, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::set<unsigned int&>(hb_vector_t<unsigned char, false> const&, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::set<unsigned int&>(hb_vector_t<int, false> const* const&, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<unsigned int>(unsigned int const&, unsigned int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, face_table_info_t, false>::set<face_table_info_t>(unsigned int const&, face_table_info_t&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<bool&>(unsigned int const&, bool&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_set_t, false>::set<hb_set_t>(unsigned int const&, hb_set_t&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<OT::OffsetTo<OT::ClipBox, OT::NumType<true, unsigned int, 3u>, void, true> const&>(unsigned int const&, OT::OffsetTo<OT::ClipBox, OT::NumType<true, unsigned int, 3u>, void, true> const&, bool) |
295 | | template <typename VV> |
296 | | bool set (K &&key, VV&& value, bool overwrite = true) |
297 | 0 | { |
298 | 0 | uint32_t hash = hb_hash (key); |
299 | 0 | return set_with_hash (std::move (key), hash, std::forward<VV> (value), overwrite); |
300 | 0 | } Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<int>(unsigned int&&, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<unsigned int&>(unsigned int&&, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, OT::Feature const*, false>::set<OT::Feature const*>(unsigned int&&, OT::Feature const*&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::set<unsigned int&>(hb_hashmap_t<unsigned int, Triple, false> const*&&, unsigned int&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::set<hb_vector_t<int, false> const*>(unsigned int&&, hb_vector_t<int, false> const*&&, bool) Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::set<int>(hb_vector_t<int, false> const*&&, int&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::set<hb::unique_ptr<hb_set_t> >(unsigned int&&, hb::unique_ptr<hb_set_t>&&, bool) Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::set<unsigned int>(unsigned int&&, unsigned int&&, bool) |
301 | | bool add (const K &key) |
302 | | { |
303 | | uint32_t hash = hb_hash (key); |
304 | | return set_with_hash (key, hash, item_t::default_value ()); |
305 | | } |
306 | | |
307 | | const V& get_with_hash (const K &key, uint32_t hash) const |
308 | 0 | { |
309 | 0 | if (!items) return item_t::default_value (); |
310 | 0 | auto *item = fetch_item (key, hash); |
311 | 0 | if (item) |
312 | 0 | return item->value; |
313 | 0 | return item_t::default_value (); |
314 | 0 | } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::get_with_hash(hb_serialize_context_t::object_t const* const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::get_with_hash(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::get_with_hash(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::get_with_hash(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, TripleDistances, false>::get_with_hash(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::get_with_hash(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::get_with_hash(unsigned int const&, unsigned int) const |
315 | | const V& get (const K &key) const |
316 | 0 | { |
317 | 0 | if (!items) return item_t::default_value (); |
318 | 0 | return get_with_hash (key, hb_hash (key)); |
319 | 0 | } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::get(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::get(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::get(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, TripleDistances, false>::get(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::get(unsigned int const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::get(unsigned int const&) const |
320 | | |
321 | | void del (const K &key) |
322 | 0 | { |
323 | 0 | if (!items) return; |
324 | 0 | auto *item = fetch_item (key, hb_hash (key)); |
325 | 0 | if (item) |
326 | 0 | { |
327 | 0 | item->set_real (false); |
328 | 0 | population--; |
329 | 0 | } |
330 | 0 | } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::del(hb_serialize_context_t::object_t const* const&) Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::del(unsigned int const&) Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::del(unsigned int const&) Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::del(hb_hashmap_t<unsigned int, Triple, false> const* const&) |
331 | | |
332 | | /* Has interface. */ |
333 | 0 | const V& operator [] (K k) const { return get (k); } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::operator[](unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::operator[](unsigned int) const |
334 | | template <typename VV=V> |
335 | | bool has (const K &key, VV **vp = nullptr) const |
336 | 129k | { |
337 | 129k | if (!items) return false; |
338 | 129k | auto *item = fetch_item (key, hb_hash (key)); |
339 | 129k | if (item) |
340 | 158 | { |
341 | 158 | if (vp) *vp = std::addressof (item->value); |
342 | 158 | return true; |
343 | 158 | } |
344 | 129k | return false; |
345 | 129k | } Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::has<hb_vector_t<unsigned int, false> >(unsigned int const&, hb_vector_t<unsigned int, false>**) const bool hb_hashmap_t<unsigned int, unsigned int, true>::has<unsigned int>(unsigned int const&, unsigned int**) const Line | Count | Source | 336 | 129k | { | 337 | 129k | if (!items) return false; | 338 | 129k | auto *item = fetch_item (key, hb_hash (key)); | 339 | 129k | if (item) | 340 | 158 | { | 341 | 158 | if (vp) *vp = std::addressof (item->value); | 342 | 158 | return true; | 343 | 158 | } | 344 | 129k | return false; | 345 | 129k | } |
Unexecuted instantiation: bool hb_hashmap_t<unsigned int, unsigned int, true>::has<unsigned int const>(unsigned int const&, unsigned int const**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, OT::Feature const*, false>::has<OT::Feature const*>(unsigned int const&, OT::Feature const***) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::has<hb::unique_ptr<hb_set_t> >(unsigned int const&, hb::unique_ptr<hb_set_t>**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, Triple, false>::has<Triple>(unsigned int const&, Triple**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, TripleDistances, false>::has<TripleDistances>(unsigned int const&, TripleDistances**) const Unexecuted instantiation: bool hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::has<unsigned int>(hb::shared_ptr<hb_map_t> const&, unsigned int**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_pair_t<void const*, void const*>, false>::has<hb_pair_t<void const*, void const*> >(unsigned int const&, hb_pair_t<void const*, void const*>**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::has<hb::shared_ptr<hb_set_t> >(unsigned int const&, hb::shared_ptr<hb_set_t>**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::has<hb_pair_t<unsigned int, int> >(unsigned int const&, hb_pair_t<unsigned int, int>**) const Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<char, false> const*, unsigned int, false>::has<unsigned int>(hb_vector_t<char, false> const* const&, unsigned int**) const Unexecuted instantiation: bool hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::has<unsigned int>(hb_hashmap_t<unsigned int, Triple, false> const* const&, unsigned int**) const Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::has<unsigned int>(hb_vector_t<int, false> const* const&, unsigned int**) const Unexecuted instantiation: bool hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::has<unsigned int>(hb_vector_t<unsigned char, false> const&, unsigned int**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, face_table_info_t, false>::has<face_table_info_t>(unsigned int const&, face_table_info_t**) const Unexecuted instantiation: bool hb_hashmap_t<unsigned int, hb_set_t, false>::has<hb_set_t>(unsigned int const&, hb_set_t**) const |
346 | | item_t *fetch_item (const K &key, uint32_t hash) const |
347 | 129k | { |
348 | 129k | hash &= 0x3FFFFFFF; // We only store lower 30bit of hash |
349 | 129k | unsigned int i = hash % prime; |
350 | 129k | unsigned step = 0; |
351 | 130k | while (items[i].is_used ()) |
352 | 635 | { |
353 | 635 | if ((std::is_integral<K>::value || items[i].hash == hash) && |
354 | 635 | items[i] == key) |
355 | 158 | { |
356 | 158 | if (items[i].is_real ()) |
357 | 158 | return &items[i]; |
358 | 0 | else |
359 | 0 | return nullptr; |
360 | 158 | } |
361 | 477 | i = (i + ++step) & mask; |
362 | 477 | } |
363 | 129k | return nullptr; |
364 | 129k | } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::fetch_item(hb_serialize_context_t::object_t const* const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::fetch_item(unsigned int const&, unsigned int) const hb_hashmap_t<unsigned int, unsigned int, true>::fetch_item(unsigned int const&, unsigned int) const Line | Count | Source | 347 | 129k | { | 348 | 129k | hash &= 0x3FFFFFFF; // We only store lower 30bit of hash | 349 | 129k | unsigned int i = hash % prime; | 350 | 129k | unsigned step = 0; | 351 | 130k | while (items[i].is_used ()) | 352 | 635 | { | 353 | 635 | if ((std::is_integral<K>::value || items[i].hash == hash) && | 354 | 635 | items[i] == key) | 355 | 158 | { | 356 | 158 | if (items[i].is_real ()) | 357 | 158 | return &items[i]; | 358 | 0 | else | 359 | 0 | return nullptr; | 360 | 158 | } | 361 | 477 | i = (i + ++step) & mask; | 362 | 477 | } | 363 | 129k | return nullptr; | 364 | 129k | } |
Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, TripleDistances, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::fetch_item(hb::shared_ptr<hb_map_t> const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<void const*, void const*>, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<char, false> const*, unsigned int, false>::fetch_item(hb_vector_t<char, false> const* const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::fetch_item(hb_hashmap_t<unsigned int, Triple, false> const* const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::fetch_item(hb_vector_t<int, false> const* const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::fetch_item(hb_vector_t<unsigned char, false> const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::fetch_item(unsigned int const&, unsigned int) const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::fetch_item(unsigned int const&, unsigned int) const |
365 | | /* Projection. */ |
366 | | const V& operator () (K k) const { return get (k); } |
367 | | |
368 | 5.39k | unsigned size () const { return mask ? mask + 1 : 0; } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::size() const hb_hashmap_t<unsigned int, unsigned int, true>::size() const Line | Count | Source | 368 | 5.39k | unsigned size () const { return mask ? mask + 1 : 0; } |
Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::size() const Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::size() const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::size() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::size() const Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::size() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::size() const |
369 | | |
370 | | void clear () |
371 | 0 | { |
372 | 0 | if (unlikely (!successful)) return; |
373 | 0 |
|
374 | 0 | for (auto &_ : hb_iter (items, size ())) |
375 | 0 | { |
376 | 0 | /* Reconstruct items. */ |
377 | 0 | _.~item_t (); |
378 | 0 | new (&_) item_t (); |
379 | 0 | } |
380 | 0 |
|
381 | 0 | population = occupancy = 0; |
382 | 0 | } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::clear() Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::clear() |
383 | | |
384 | 0 | bool is_empty () const { return population == 0; } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::is_empty() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::is_empty() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::is_empty() const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::is_empty() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::is_empty() const |
385 | 0 | explicit operator bool () const { return !is_empty (); } Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::operator bool() const Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::operator bool() const Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::operator bool() const |
386 | | |
387 | | uint32_t hash () const |
388 | 0 | { |
389 | 0 | return |
390 | 0 | + iter_items () |
391 | 0 | | hb_reduce ([] (uint32_t h, const item_t &_) { return h ^ _.total_hash (); }, (uint32_t) 0u) |
392 | 0 | ; |
393 | 0 | } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::hash() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::hash() const |
394 | | |
395 | | bool is_equal (const hb_hashmap_t &other) const |
396 | 0 | { |
397 | 0 | if (population != other.population) return false; |
398 | 0 |
|
399 | 0 | for (auto pair : iter ()) |
400 | 0 | if (other.get (pair.first) != pair.second) |
401 | 0 | return false; |
402 | 0 |
|
403 | 0 | return true; |
404 | 0 | } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::is_equal(hb_hashmap_t<unsigned int, unsigned int, true> const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::is_equal(hb_hashmap_t<unsigned int, Triple, false> const&) const |
405 | 0 | bool operator == (const hb_hashmap_t &other) const { return is_equal (other); } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::operator==(hb_hashmap_t<unsigned int, unsigned int, true> const&) const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::operator==(hb_hashmap_t<unsigned int, Triple, false> const&) const |
406 | | bool operator != (const hb_hashmap_t &other) const { return !is_equal (other); } |
407 | | |
408 | 0 | unsigned int get_population () const { return population; } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::get_population() const Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::get_population() const Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::get_population() const Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::get_population() const |
409 | | |
410 | | void update (const hb_hashmap_t &other) |
411 | | { |
412 | | if (unlikely (!successful)) return; |
413 | | |
414 | | hb_copy (other, *this); |
415 | | } |
416 | | |
417 | | /* |
418 | | * Iterator |
419 | | */ |
420 | | |
421 | | auto iter_items () const HB_AUTO_RETURN |
422 | | ( |
423 | | + hb_iter (items, this->size ()) |
424 | | | hb_filter (&item_t::is_real) |
425 | | ) |
426 | | auto iter_ref () const HB_AUTO_RETURN |
427 | | ( |
428 | | + this->iter_items () |
429 | | | hb_map (&item_t::get_pair_ref) |
430 | | ) |
431 | | auto iter () const HB_AUTO_RETURN |
432 | | ( |
433 | | + this->iter_items () |
434 | | | hb_map (&item_t::get_pair) |
435 | | ) |
436 | | auto keys_ref () const HB_AUTO_RETURN |
437 | | ( |
438 | | + this->iter_items () |
439 | | | hb_map (&item_t::get_key) |
440 | | ) |
441 | | auto keys () const HB_AUTO_RETURN |
442 | | ( |
443 | | + this->keys_ref () |
444 | | | hb_map (hb_ridentity) |
445 | | ) |
446 | | auto values_ref () const HB_AUTO_RETURN |
447 | | ( |
448 | | + this->iter_items () |
449 | | | hb_map (&item_t::get_value) |
450 | | ) |
451 | | auto values () const HB_AUTO_RETURN |
452 | | ( |
453 | | + this->values_ref () |
454 | | | hb_map (hb_ridentity) |
455 | | ) |
456 | | |
457 | | /* C iterator. */ |
458 | | bool next (int *idx, |
459 | | K *key, |
460 | | V *value) const |
461 | | { |
462 | | unsigned i = (unsigned) (*idx + 1); |
463 | | |
464 | | unsigned count = size (); |
465 | | while (i < count && !items[i].is_real ()) |
466 | | i++; |
467 | | |
468 | | if (i >= count) |
469 | | { |
470 | | *idx = -1; |
471 | | return false; |
472 | | } |
473 | | |
474 | | *key = items[i].key; |
475 | | *value = items[i].value; |
476 | | |
477 | | *idx = (signed) i; |
478 | | return true; |
479 | | } |
480 | | |
481 | | /* Sink interface. */ |
482 | | hb_hashmap_t& operator << (const hb_pair_t<K, V>& v) |
483 | 0 | { set (v.first, v.second); return *this; } Unexecuted instantiation: hb_hashmap_t<unsigned int, unsigned int, true>::operator<<(hb_pair_t<unsigned int, unsigned int> const&) Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::operator<<(hb_pair_t<unsigned int, Triple> const&) |
484 | | hb_hashmap_t& operator << (const hb_pair_t<K, V&&>& v) |
485 | | { set (v.first, std::move (v.second)); return *this; } |
486 | | hb_hashmap_t& operator << (const hb_pair_t<K&&, V>& v) |
487 | | { set (std::move (v.first), v.second); return *this; } |
488 | | hb_hashmap_t& operator << (const hb_pair_t<K&&, V&&>& v) |
489 | | { set (std::move (v.first), std::move (v.second)); return *this; } |
490 | | |
491 | | static unsigned int prime_for (unsigned int shift) |
492 | 5.39k | { |
493 | | /* Following comment and table copied from glib. */ |
494 | | /* Each table size has an associated prime modulo (the first prime |
495 | | * lower than the table size) used to find the initial bucket. Probing |
496 | | * then works modulo 2^n. The prime modulo is necessary to get a |
497 | | * good distribution with poor hash functions. |
498 | | */ |
499 | | /* Not declaring static to make all kinds of compilers happy... */ |
500 | 5.39k | /*static*/ const unsigned int prime_mod [32] = |
501 | 5.39k | { |
502 | 5.39k | 1, /* For 1 << 0 */ |
503 | 5.39k | 2, |
504 | 5.39k | 3, |
505 | 5.39k | 7, |
506 | 5.39k | 13, |
507 | 5.39k | 31, |
508 | 5.39k | 61, |
509 | 5.39k | 127, |
510 | 5.39k | 251, |
511 | 5.39k | 509, |
512 | 5.39k | 1021, |
513 | 5.39k | 2039, |
514 | 5.39k | 4093, |
515 | 5.39k | 8191, |
516 | 5.39k | 16381, |
517 | 5.39k | 32749, |
518 | 5.39k | 65521, /* For 1 << 16 */ |
519 | 5.39k | 131071, |
520 | 5.39k | 262139, |
521 | 5.39k | 524287, |
522 | 5.39k | 1048573, |
523 | 5.39k | 2097143, |
524 | 5.39k | 4194301, |
525 | 5.39k | 8388593, |
526 | 5.39k | 16777213, |
527 | 5.39k | 33554393, |
528 | 5.39k | 67108859, |
529 | 5.39k | 134217689, |
530 | 5.39k | 268435399, |
531 | 5.39k | 536870909, |
532 | 5.39k | 1073741789, |
533 | 5.39k | 2147483647 /* For 1 << 31 */ |
534 | 5.39k | }; |
535 | | |
536 | 5.39k | if (unlikely (shift >= ARRAY_LENGTH (prime_mod))) |
537 | 0 | return prime_mod[ARRAY_LENGTH (prime_mod) - 1]; |
538 | | |
539 | 5.39k | return prime_mod[shift]; |
540 | 5.39k | } Unexecuted instantiation: hb_hashmap_t<hb_serialize_context_t::object_t const*, unsigned int, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false>::prime_for(unsigned int) hb_hashmap_t<unsigned int, unsigned int, true>::prime_for(unsigned int) Line | Count | Source | 492 | 5.39k | { | 493 | | /* Following comment and table copied from glib. */ | 494 | | /* Each table size has an associated prime modulo (the first prime | 495 | | * lower than the table size) used to find the initial bucket. Probing | 496 | | * then works modulo 2^n. The prime modulo is necessary to get a | 497 | | * good distribution with poor hash functions. | 498 | | */ | 499 | | /* Not declaring static to make all kinds of compilers happy... */ | 500 | 5.39k | /*static*/ const unsigned int prime_mod [32] = | 501 | 5.39k | { | 502 | 5.39k | 1, /* For 1 << 0 */ | 503 | 5.39k | 2, | 504 | 5.39k | 3, | 505 | 5.39k | 7, | 506 | 5.39k | 13, | 507 | 5.39k | 31, | 508 | 5.39k | 61, | 509 | 5.39k | 127, | 510 | 5.39k | 251, | 511 | 5.39k | 509, | 512 | 5.39k | 1021, | 513 | 5.39k | 2039, | 514 | 5.39k | 4093, | 515 | 5.39k | 8191, | 516 | 5.39k | 16381, | 517 | 5.39k | 32749, | 518 | 5.39k | 65521, /* For 1 << 16 */ | 519 | 5.39k | 131071, | 520 | 5.39k | 262139, | 521 | 5.39k | 524287, | 522 | 5.39k | 1048573, | 523 | 5.39k | 2097143, | 524 | 5.39k | 4194301, | 525 | 5.39k | 8388593, | 526 | 5.39k | 16777213, | 527 | 5.39k | 33554393, | 528 | 5.39k | 67108859, | 529 | 5.39k | 134217689, | 530 | 5.39k | 268435399, | 531 | 5.39k | 536870909, | 532 | 5.39k | 1073741789, | 533 | 5.39k | 2147483647 /* For 1 << 31 */ | 534 | 5.39k | }; | 535 | | | 536 | 5.39k | if (unlikely (shift >= ARRAY_LENGTH (prime_mod))) | 537 | 0 | return prime_mod[ARRAY_LENGTH (prime_mod) - 1]; | 538 | | | 539 | 5.39k | return prime_mod[shift]; | 540 | 5.39k | } |
Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::unique_ptr<hb_set_t>, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, Triple, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb::shared_ptr<hb_map_t>, unsigned int, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb::shared_ptr<hb_set_t>, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, OT::Feature const*, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb_hashmap_t<unsigned int, Triple, false> const*, unsigned int, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_vector_t<int, false> const*, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<int, false> const*, unsigned int, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<hb_vector_t<unsigned char, false>, unsigned int, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, face_table_info_t, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_pair_t<unsigned int, int>, false>::prime_for(unsigned int) Unexecuted instantiation: hb_hashmap_t<unsigned int, hb_set_t, false>::prime_for(unsigned int) |
541 | | }; |
542 | | |
543 | | /* |
544 | | * hb_map_t |
545 | | */ |
546 | | |
547 | | struct hb_map_t : hb_hashmap_t<hb_codepoint_t, |
548 | | hb_codepoint_t, |
549 | | true> |
550 | | { |
551 | | using hashmap = hb_hashmap_t<hb_codepoint_t, |
552 | | hb_codepoint_t, |
553 | | true>; |
554 | | |
555 | | ~hb_map_t () = default; |
556 | 5.39k | hb_map_t () : hashmap () {} |
557 | 0 | hb_map_t (const hb_map_t &o) : hashmap ((hashmap &) o) {} |
558 | 0 | hb_map_t (hb_map_t &&o) noexcept : hashmap (std::move ((hashmap &) o)) {} |
559 | | hb_map_t& operator= (const hb_map_t&) = default; |
560 | | hb_map_t& operator= (hb_map_t&&) = default; |
561 | 0 | hb_map_t (std::initializer_list<hb_codepoint_pair_t> lst) : hashmap (lst) {} |
562 | | template <typename Iterable, |
563 | | hb_requires (hb_is_iterable (Iterable))> |
564 | | hb_map_t (const Iterable &o) : hashmap (o) {} |
565 | | }; |
566 | | |
567 | | |
568 | | #endif /* HB_MAP_HH */ |