[bit-set] Fix may_intersect() logic

This commit is contained in:
Behdad Esfahbod 2025-02-04 22:53:17 +00:00
parent b30c65e271
commit 749dc1eee0

View file

@ -366,11 +366,14 @@ struct hb_bit_set_t
unsigned int a = 0, b = 0;
for (; a < na && b < nb; )
{
if (page_map.arrayZ[a].major == other.page_map.arrayZ[b].major &&
page_at (a).may_intersect (other.page_at (b)))
return true;
if (page_map.arrayZ[a].major < other.page_map.arrayZ[b].major)
if (page_map.arrayZ[a].major == other.page_map.arrayZ[b].major)
{
if (likely (page_at (a).may_intersect (other.page_at (b))))
return true;
a++;
b++;
}
else if (page_map.arrayZ[a].major < other.page_map.arrayZ[b].major)
a++;
else
b++;