[bit-set] Micro-optimize process()

This commit is contained in:
Behdad Esfahbod 2022-11-24 14:26:28 -07:00
parent d77903db7b
commit cf9b9929df
1 changed files with 9 additions and 9 deletions

View File

@ -540,21 +540,21 @@ struct hb_bit_set_t
b = nb; b = nb;
for (; a && b; ) for (; a && b; )
{ {
if (page_map[a - 1].major == other.page_map[b - 1].major) if (page_map.arrayZ[a - 1].major == other.page_map.arrayZ[b - 1].major)
{ {
a--; a--;
b--; b--;
count--; count--;
page_map[count] = page_map[a]; page_map.arrayZ[count] = page_map.arrayZ[a];
page_at (count).v = op (page_at (a).v, other.page_at (b).v); page_at (count).v = op (page_at (a).v, other.page_at (b).v);
} }
else if (page_map[a - 1].major > other.page_map[b - 1].major) else if (page_map.arrayZ[a - 1].major > other.page_map.arrayZ[b - 1].major)
{ {
a--; a--;
if (passthru_left) if (passthru_left)
{ {
count--; count--;
page_map[count] = page_map[a]; page_map.arrayZ[count] = page_map.arrayZ[a];
} }
} }
else else
@ -563,8 +563,8 @@ struct hb_bit_set_t
if (passthru_right) if (passthru_right)
{ {
count--; count--;
page_map[count].major = other.page_map[b].major; page_map.arrayZ[count].major = other.page_map.arrayZ[b].major;
page_map[count].index = next_page++; page_map.arrayZ[count].index = next_page++;
page_at (count).v = other.page_at (b).v; page_at (count).v = other.page_at (b).v;
} }
} }
@ -574,15 +574,15 @@ struct hb_bit_set_t
{ {
a--; a--;
count--; count--;
page_map[count] = page_map [a]; page_map.arrayZ[count] = page_map.arrayZ[a];
} }
if (passthru_right) if (passthru_right)
while (b) while (b)
{ {
b--; b--;
count--; count--;
page_map[count].major = other.page_map[b].major; page_map.arrayZ[count].major = other.page_map.arrayZ[b].major;
page_map[count].index = next_page++; page_map.arrayZ[count].index = next_page++;
page_at (count).v = other.page_at (b).v; page_at (count).v = other.page_at (b).v;
} }
assert (!count); assert (!count);