aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-15 09:44:13 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-15 09:44:13 +0000
commita5d7f2e5929d11e4c7c146002f7704cb4a65907a (patch)
tree7a0f8f64a029a2d62e112c1f18e4dd1546900a46 /grid.c
parentgrid: reflow: use a sorted array for tracking points (diff)
grid: reflow: tag tracking point if-statements with likely/unlikely
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/grid.c b/grid.c
index a580dfff..d888508e 100644
--- a/grid.c
+++ b/grid.c
@@ -531,7 +531,7 @@ grid_resize_and_reflow(
bool is_tracking_point = false;
struct coord *tp = *next_tp;
- if (tp->row == old_row_idx && tp->col == c)
+ if (unlikely(tp->row == old_row_idx && tp->col == c))
is_tracking_point = true;
/* If there’s an URI start/end point here, we need to make
@@ -539,14 +539,14 @@ grid_resize_and_reflow(
bool on_uri = false;
if (old_row->extra != NULL) {
tll_foreach(old_row->extra->uri_ranges, it) {
- if (it->item.start == c || it->item.end == c) {
+ if (unlikely(it->item.start == c || it->item.end == c)) {
on_uri = true;
break;
}
}
}
- if (wc == 0 && !(is_tracking_point | on_uri)) {
+ if (wc == 0 && likely(!(is_tracking_point | on_uri))) {
empty_count++;
continue;
}
@@ -601,7 +601,7 @@ grid_resize_and_reflow(
new_row->cells[new_col_idx] = *old_cell;
/* Translate tracking point(s) */
- if (is_tracking_point) {
+ if (unlikely(is_tracking_point)) {
do {
xassert(tp != NULL);
xassert(tp->row == old_row_idx);
@@ -619,7 +619,7 @@ grid_resize_and_reflow(
(tp->row == old_row_idx && tp->col > c));
}
- if (on_uri)
+ if (unlikely(on_uri))
reflow_uri_ranges(old_row, new_row, c, new_col_idx);
new_col_idx++;