[set] Add successful check in swap()
This commit is contained in:
parent
b860b44229
commit
38debbab7e
|
@ -44,6 +44,8 @@ struct hb_bit_set_invertible_t
|
||||||
hb_bit_set_invertible_t& operator= (hb_bit_set_invertible_t&& o) = default;
|
hb_bit_set_invertible_t& operator= (hb_bit_set_invertible_t&& o) = default;
|
||||||
friend void swap (hb_bit_set_invertible_t &a, hb_bit_set_invertible_t &b)
|
friend void swap (hb_bit_set_invertible_t &a, hb_bit_set_invertible_t &b)
|
||||||
{
|
{
|
||||||
|
if (likely (!a.s.successful || !b.s.successful))
|
||||||
|
return;
|
||||||
hb_swap (a.inverted, b.inverted);
|
hb_swap (a.inverted, b.inverted);
|
||||||
hb_swap (a.s, b.s);
|
hb_swap (a.s, b.s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ struct hb_bit_set_t
|
||||||
hb_bit_set_t& operator= (hb_bit_set_t&& other) { hb_swap (*this, other); return *this; }
|
hb_bit_set_t& operator= (hb_bit_set_t&& other) { hb_swap (*this, other); return *this; }
|
||||||
friend void swap (hb_bit_set_t &a, hb_bit_set_t &b)
|
friend void swap (hb_bit_set_t &a, hb_bit_set_t &b)
|
||||||
{
|
{
|
||||||
|
if (likely (!a.successful || !b.successful))
|
||||||
|
return;
|
||||||
hb_swap (a.successful, b.successful);
|
hb_swap (a.successful, b.successful);
|
||||||
hb_swap (a.population, b.population);
|
hb_swap (a.population, b.population);
|
||||||
hb_swap (a.last_page_lookup, b.last_page_lookup);
|
hb_swap (a.last_page_lookup, b.last_page_lookup);
|
||||||
|
|
Loading…
Reference in New Issue