Coverage Report

Created: 2024-05-15 07:04

/src/harfbuzz/src/hb-bit-set-invertible.hh
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright © 2012,2017  Google, Inc.
3
 * Copyright © 2021 Behdad Esfahbod
4
 *
5
 *  This is part of HarfBuzz, a text shaping library.
6
 *
7
 * Permission is hereby granted, without written agreement and without
8
 * license or royalty fees, to use, copy, modify, and distribute this
9
 * software and its documentation for any purpose, provided that the
10
 * above copyright notice and the following two paragraphs appear in
11
 * all copies of this software.
12
 *
13
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17
 * DAMAGE.
18
 *
19
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24
 *
25
 * Google Author(s): Behdad Esfahbod
26
 */
27
28
#ifndef HB_BIT_SET_INVERTIBLE_HH
29
#define HB_BIT_SET_INVERTIBLE_HH
30
31
#include "hb.hh"
32
#include "hb-bit-set.hh"
33
34
35
struct hb_bit_set_invertible_t
36
{
37
  hb_bit_set_t s;
38
  bool inverted = false;
39
40
1.23M
  hb_bit_set_invertible_t () = default;
41
  hb_bit_set_invertible_t (const hb_bit_set_invertible_t& o) = default;
42
0
  hb_bit_set_invertible_t (hb_bit_set_invertible_t&& other) : hb_bit_set_invertible_t () { hb_swap (*this, other); }
43
  hb_bit_set_invertible_t& operator= (const hb_bit_set_invertible_t& o) = default;
44
0
  hb_bit_set_invertible_t& operator= (hb_bit_set_invertible_t&& other) { hb_swap (*this, other); return *this; }
45
  friend void swap (hb_bit_set_invertible_t &a, hb_bit_set_invertible_t &b)
46
0
  {
47
0
    if (likely (!a.s.successful || !b.s.successful))
48
0
      return;
49
0
    hb_swap (a.inverted, b.inverted);
50
0
    hb_swap (a.s, b.s);
51
0
  }
52
53
1.23M
  void init () { s.init (); inverted = false; }
54
1.23M
  void fini () { s.fini (); }
55
0
  void err () { s.err (); }
56
0
  bool in_error () const { return s.in_error (); }
57
0
  explicit operator bool () const { return !is_empty (); }
58
59
0
  void alloc (unsigned sz) { s.alloc (sz); }
60
  void reset ()
61
0
  {
62
0
    s.reset ();
63
0
    inverted = false;
64
0
  }
65
  void clear ()
66
0
  {
67
0
    s.clear ();
68
0
    if (likely (s.successful))
69
0
      inverted = false;
70
0
  }
71
  void invert ()
72
0
  {
73
0
    if (likely (s.successful))
74
0
      inverted = !inverted;
75
0
  }
76
77
  bool is_inverted () const
78
0
  {
79
0
    return inverted;
80
0
  }
81
82
  bool is_empty () const
83
0
  {
84
0
    hb_codepoint_t v = INVALID;
85
0
    next (&v);
86
0
    return v == INVALID;
87
0
  }
88
0
  uint32_t hash () const { return s.hash () ^ (uint32_t) inverted; }
89
90
  hb_codepoint_t get_min () const
91
0
  {
92
0
    hb_codepoint_t v = INVALID;
93
0
    next (&v);
94
0
    return v;
95
0
  }
96
  hb_codepoint_t get_max () const
97
0
  {
98
0
    hb_codepoint_t v = INVALID;
99
0
    previous (&v);
100
0
    return v;
101
0
  }
102
  unsigned int get_population () const
103
0
  { return inverted ? INVALID - s.get_population () : s.get_population (); }
104
105
106
2.17M
  void add (hb_codepoint_t g) { unlikely (inverted) ? s.del (g) : s.add (g); }
107
  bool add_range (hb_codepoint_t a, hb_codepoint_t b)
108
4.56M
  { return unlikely (inverted) ? ((void) s.del_range (a, b), true) : s.add_range (a, b); }
109
110
  template <typename T>
111
  void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
112
0
  { inverted ? s.del_array (array, count, stride) : s.add_array (array, count, stride); }
Unexecuted instantiation: void hb_bit_set_invertible_t::add_array<OT::Index>(OT::Index const*, unsigned int, unsigned int)
Unexecuted instantiation: void hb_bit_set_invertible_t::add_array<OT::HBGlyphID16>(OT::HBGlyphID16 const*, unsigned int, unsigned int)
Unexecuted instantiation: void hb_bit_set_invertible_t::add_array<OT::HBGlyphID24>(OT::HBGlyphID24 const*, unsigned int, unsigned int)
113
  template <typename T>
114
  void add_array (const hb_array_t<const T>& arr) { add_array (&arr, arr.len ()); }
115
116
  /* Might return false if array looks unsorted.
117
   * Used for faster rejection of corrupt data. */
118
  template <typename T>
119
  bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
120
0
  { return inverted ? s.del_sorted_array (array, count, stride) : s.add_sorted_array (array, count, stride); }
Unexecuted instantiation: bool hb_bit_set_invertible_t::add_sorted_array<OT::HBGlyphID16>(OT::HBGlyphID16 const*, unsigned int, unsigned int)
Unexecuted instantiation: bool hb_bit_set_invertible_t::add_sorted_array<OT::HBGlyphID24>(OT::HBGlyphID24 const*, unsigned int, unsigned int)
Unexecuted instantiation: bool hb_bit_set_invertible_t::add_sorted_array<unsigned int>(unsigned int const*, unsigned int, unsigned int)
121
  template <typename T>
122
  bool add_sorted_array (const hb_sorted_array_t<const T>& arr) { return add_sorted_array (&arr, arr.len ()); }
123
124
25.1M
  void del (hb_codepoint_t g) { unlikely (inverted) ? s.add (g) : s.del (g); }
125
  void del_range (hb_codepoint_t a, hb_codepoint_t b)
126
340k
  { unlikely (inverted) ? (void) s.add_range (a, b) : s.del_range (a, b); }
127
128
0
  bool get (hb_codepoint_t g) const { return s.get (g) ^ inverted; }
129
130
  /* Has interface. */
131
0
  bool operator [] (hb_codepoint_t k) const { return get (k); }
132
0
  bool has (hb_codepoint_t k) const { return (*this)[k]; }
133
  /* Predicate. */
134
0
  bool operator () (hb_codepoint_t k) const { return has (k); }
135
136
  /* Sink interface. */
137
  hb_bit_set_invertible_t& operator << (hb_codepoint_t v)
138
0
  { add (v); return *this; }
139
  hb_bit_set_invertible_t& operator << (const hb_pair_t<hb_codepoint_t, hb_codepoint_t>& range)
140
0
  { add_range (range.first, range.second); return *this; }
141
142
  bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
143
0
  {
144
0
    hb_codepoint_t c = first - 1;
145
0
    return next (&c) && c <= last;
146
0
  }
147
148
  void set (const hb_bit_set_invertible_t &other)
149
0
  {
150
0
    s.set (other.s);
151
0
    if (likely (s.successful))
152
0
      inverted = other.inverted;
153
0
  }
154
155
  bool is_equal (const hb_bit_set_invertible_t &other) const
156
0
  {
157
0
    if (likely (inverted == other.inverted))
158
0
      return s.is_equal (other.s);
159
0
    else
160
0
    {
161
      /* TODO Add iter_ranges() and use here. */
162
0
      auto it1 = iter ();
163
0
      auto it2 = other.iter ();
164
0
      return hb_all (+ hb_zip (it1, it2)
165
0
         | hb_map ([](hb_pair_t<hb_codepoint_t, hb_codepoint_t> _) { return _.first == _.second; }));
166
0
    }
167
0
  }
168
169
  bool is_subset (const hb_bit_set_invertible_t &larger_set) const
170
0
  {
171
0
    if (unlikely (inverted != larger_set.inverted))
172
0
      return hb_all (hb_iter (s) | hb_map (larger_set.s));
173
0
    else
174
0
      return unlikely (inverted) ? larger_set.s.is_subset (s) : s.is_subset (larger_set.s);
175
0
  }
176
177
  protected:
178
  template <typename Op>
179
  void process (const Op& op, const hb_bit_set_invertible_t &other)
180
0
  { s.process (op, other.s); }
Unexecuted instantiation: hb-aat-layout.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-layout.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-layout.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-layout.cc:void hb_bit_set_invertible_t::process<$_25>($_25 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-layout.cc:void hb_bit_set_invertible_t::process<$_21>($_21 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-map.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-map.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-map.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-map.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-aat-map.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-buffer.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-buffer.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-buffer.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-buffer.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-buffer.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-common.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-common.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-common.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-common.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-common.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-face.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-face.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-face.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-face.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-face.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-font.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-font.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-font.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-font.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-font.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-map.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-map.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-map.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-map.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-map.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-color.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-color.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-color.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-color.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-color.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-face.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-face.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-face.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-face.cc:void hb_bit_set_invertible_t::process<$_25>($_25 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-face.cc:void hb_bit_set_invertible_t::process<$_21>($_21 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-font.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-font.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-font.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-font.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-font.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void hb_bit_set_invertible_t::process<$_25>($_25 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-layout.cc:void hb_bit_set_invertible_t::process<$_21>($_21 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-math.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-math.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-math.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-math.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-math.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-meta.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-meta.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-meta.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-meta.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-meta.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-metrics.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-metrics.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-metrics.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-metrics.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-metrics.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-name.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-name.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-name.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-name.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-name.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-var.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-var.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-var.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-var.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-var.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-set.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-set.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-set.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-set.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-set.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff1-table.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff1-table.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff1-table.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff1-table.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff1-table.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff2-table.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff2-table.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff2-table.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff2-table.cc:void hb_bit_set_invertible_t::process<$_24>($_24 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-cff2-table.cc:void hb_bit_set_invertible_t::process<$_20>($_20 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-map.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-map.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-map.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-map.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-map.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void hb_bit_set_invertible_t::process<$_25>($_25 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-arabic.cc:void hb_bit_set_invertible_t::process<$_21>($_21 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-default.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-default.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-default.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-default.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-default.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hangul.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hangul.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hangul.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hangul.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hangul.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hebrew.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hebrew.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hebrew.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hebrew.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-hebrew.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-khmer.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-khmer.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-khmer.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-khmer.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-khmer.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-myanmar.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-myanmar.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-myanmar.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-myanmar.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-myanmar.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-syllabic.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-syllabic.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-syllabic.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-syllabic.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-syllabic.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-thai.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-thai.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-thai.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-thai.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-thai.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-use.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-use.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-use.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-use.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-use.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-vowel-constraints.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-vowel-constraints.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-vowel-constraints.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-vowel-constraints.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-vowel-constraints.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void hb_bit_set_invertible_t::process<$_18>($_18 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void hb_bit_set_invertible_t::process<$_25>($_25 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-fallback.cc:void hb_bit_set_invertible_t::process<$_21>($_21 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-normalize.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-normalize.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-normalize.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-normalize.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shape-normalize.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic-table.cc:void hb_bit_set_invertible_t::process<$_16>($_16 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic-table.cc:void hb_bit_set_invertible_t::process<$_15>($_15 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic-table.cc:void hb_bit_set_invertible_t::process<$_17>($_17 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic-table.cc:void hb_bit_set_invertible_t::process<$_23>($_23 const&, hb_bit_set_invertible_t const&)
Unexecuted instantiation: hb-ot-shaper-indic-table.cc:void hb_bit_set_invertible_t::process<$_19>($_19 const&, hb_bit_set_invertible_t const&)
181
  public:
182
  void union_ (const hb_bit_set_invertible_t &other)
183
0
  {
184
0
    if (likely (inverted == other.inverted))
185
0
    {
186
0
      if (unlikely (inverted))
187
0
  process (hb_bitwise_and, other);
188
0
      else
189
0
  process (hb_bitwise_or, other); /* Main branch. */
190
0
    }
191
0
    else
192
0
    {
193
0
      if (unlikely (inverted))
194
0
  process (hb_bitwise_gt, other);
195
0
      else
196
0
  process (hb_bitwise_lt, other);
197
0
    }
198
0
    if (likely (s.successful))
199
0
      inverted = inverted || other.inverted;
200
0
  }
201
  void intersect (const hb_bit_set_invertible_t &other)
202
0
  {
203
0
    if (likely (inverted == other.inverted))
204
0
    {
205
0
      if (unlikely (inverted))
206
0
  process (hb_bitwise_or, other);
207
0
      else
208
0
  process (hb_bitwise_and, other); /* Main branch. */
209
0
    }
210
0
    else
211
0
    {
212
0
      if (unlikely (inverted))
213
0
  process (hb_bitwise_lt, other);
214
0
      else
215
0
  process (hb_bitwise_gt, other);
216
0
    }
217
0
    if (likely (s.successful))
218
0
      inverted = inverted && other.inverted;
219
0
  }
220
  void subtract (const hb_bit_set_invertible_t &other)
221
0
  {
222
0
    if (likely (inverted == other.inverted))
223
0
    {
224
0
      if (unlikely (inverted))
225
0
  process (hb_bitwise_lt, other);
226
0
      else
227
0
  process (hb_bitwise_gt, other); /* Main branch. */
228
0
    }
229
0
    else
230
0
    {
231
0
      if (unlikely (inverted))
232
0
  process (hb_bitwise_or, other);
233
0
      else
234
0
  process (hb_bitwise_and, other);
235
0
    }
236
0
    if (likely (s.successful))
237
0
      inverted = inverted && !other.inverted;
238
0
  }
239
  void symmetric_difference (const hb_bit_set_invertible_t &other)
240
0
  {
241
0
    process (hb_bitwise_xor, other);
242
0
    if (likely (s.successful))
243
0
      inverted = inverted ^ other.inverted;
244
0
  }
245
246
  bool next (hb_codepoint_t *codepoint) const
247
0
  {
248
0
    if (likely (!inverted))
249
0
      return s.next (codepoint);
250
251
0
    auto old = *codepoint;
252
0
    if (unlikely (old + 1 == INVALID))
253
0
    {
254
0
      *codepoint = INVALID;
255
0
      return false;
256
0
    }
257
258
0
    auto v = old;
259
0
    s.next (&v);
260
0
    if (old + 1 < v)
261
0
    {
262
0
      *codepoint = old + 1;
263
0
      return true;
264
0
    }
265
266
0
    v = old;
267
0
    s.next_range (&old, &v);
268
269
0
    *codepoint = v + 1;
270
0
    return *codepoint != INVALID;
271
0
  }
272
  bool previous (hb_codepoint_t *codepoint) const
273
0
  {
274
0
    if (likely (!inverted))
275
0
      return s.previous (codepoint);
276
277
0
    auto old = *codepoint;
278
0
    if (unlikely (old - 1 == INVALID))
279
0
    {
280
0
      *codepoint = INVALID;
281
0
      return false;
282
0
    }
283
284
0
    auto v = old;
285
0
    s.previous (&v);
286
287
0
    if (old - 1 > v || v == INVALID)
288
0
    {
289
0
      *codepoint = old - 1;
290
0
      return true;
291
0
    }
292
293
0
    v = old;
294
0
    s.previous_range (&v, &old);
295
296
0
    *codepoint = v - 1;
297
0
    return *codepoint != INVALID;
298
0
  }
299
  bool next_range (hb_codepoint_t *first, hb_codepoint_t *last) const
300
0
  {
301
0
    if (likely (!inverted))
302
0
      return s.next_range (first, last);
303
304
0
    if (!next (last))
305
0
    {
306
0
      *last = *first = INVALID;
307
0
      return false;
308
0
    }
309
310
0
    *first = *last;
311
0
    s.next (last);
312
0
    --*last;
313
0
    return true;
314
0
  }
315
  bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
316
0
  {
317
0
    if (likely (!inverted))
318
0
      return s.previous_range (first, last);
319
320
0
    if (!previous (first))
321
0
    {
322
0
      *last = *first = INVALID;
323
0
      return false;
324
0
    }
325
326
0
    *last = *first;
327
0
    s.previous (first);
328
0
    ++*first;
329
0
    return true;
330
0
  }
331
332
  unsigned int next_many (hb_codepoint_t  codepoint,
333
        hb_codepoint_t *out,
334
        unsigned int    size) const
335
0
  {
336
0
    return inverted ? s.next_many_inverted (codepoint, out, size)
337
0
        : s.next_many (codepoint, out, size);
338
0
  }
339
340
  static constexpr hb_codepoint_t INVALID = hb_bit_set_t::INVALID;
341
342
  /*
343
   * Iterator implementation.
344
   */
345
  struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t>
346
  {
347
    static constexpr bool is_sorted_iterator = true;
348
    iter_t (const hb_bit_set_invertible_t &s_ = Null (hb_bit_set_invertible_t),
349
      bool init = true) : s (&s_), v (INVALID), l(0)
350
0
    {
351
0
      if (init)
352
0
      {
353
0
  l = s->get_population () + 1;
354
0
  __next__ ();
355
0
      }
356
0
    }
357
358
    typedef hb_codepoint_t __item_t__;
359
0
    hb_codepoint_t __item__ () const { return v; }
360
0
    bool __more__ () const { return v != INVALID; }
361
0
    void __next__ () { s->next (&v); if (l) l--; }
362
0
    void __prev__ () { s->previous (&v); }
363
0
    unsigned __len__ () const { return l; }
364
0
    iter_t end () const { return iter_t (*s, false); }
365
    bool operator != (const iter_t& o) const
366
0
    { return s != o.s || v != o.v; }
367
368
    protected:
369
    const hb_bit_set_invertible_t *s;
370
    hb_codepoint_t v;
371
    unsigned l;
372
  };
373
0
  iter_t iter () const { return iter_t (*this); }
374
0
  operator iter_t () const { return iter (); }
375
};
376
377
378
#endif /* HB_BIT_SET_INVERTIBLE_HH */