summaryrefslogtreecommitdiff
path: root/src/wayland/surface.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-11 23:30:21 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-11 23:30:21 +0300
commit5530c662bb53837d64a154e3b580d41adb6cc8b9 (patch)
tree20cdd971425e945eecd8d3b5fbe243a4bd779409 /src/wayland/surface.c
parent472ed3e4e50a165638acecaf071ec3c2c13c451f (diff)
opt: compile-time locked LUTs and branchless SIMD/ALU primitives
- Replace buffer allocation branching loop with compile-time locked 24-byte LUT indexed by (cur & 3) - Use hardware lrint rounding and array-indexed pointer offsets for scroll axes - Replace press queue button/kind conditionals with branchless bitmasking and 1:1 identity casting - Make display_has_immediate_work evaluate state flags with bitwise ALU instead of short-circuit branches
Diffstat (limited to 'src/wayland/surface.c')
-rw-r--r--src/wayland/surface.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/wayland/surface.c b/src/wayland/surface.c
index 5138201..86f30a3 100644
--- a/src/wayland/surface.c
+++ b/src/wayland/surface.c
@@ -123,14 +123,13 @@ static bool display_arm(struct yasl_display *c)
return had_pending;
}
-static bool display_has_immediate_work(const struct yasl_display *c)
+static inline bool display_has_immediate_work(const struct yasl_display *c)
{
- if (!c || c->lost) return false;
+ if (unlikely(!c || c->lost)) return false;
for (struct yasl_surface *w = c->surfaces; w; w = w->conn_next) {
- if (w->closed) continue;
- if (w->input.count > 0)
- return true;
- if (w->want_draw && !w->frame_cb && w->configured)
+ bool ready_draw = w->want_draw & (w->frame_cb == NULL) & w->configured;
+ bool has_input = (w->input.count > 0);
+ if (unlikely((ready_draw | has_input) & !w->closed))
return true;
}
return false;