From 03b058aa7b8eade6cb4d1078b17a0d9b060387cf Mon Sep 17 00:00:00 2001 From: "L. Pereira" Date: Fri, 31 Jan 2025 21:10:18 -0800 Subject: [PATCH] Sprinkle some UNLIKELY() macros in check_stack_effects() --- src/samples/forthsalon/forth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/samples/forthsalon/forth.c b/src/samples/forthsalon/forth.c index 1f9fc040f..5d0449125 100644 --- a/src/samples/forthsalon/forth.c +++ b/src/samples/forthsalon/forth.c @@ -186,12 +186,12 @@ static bool check_stack_effects(const struct forth_ctx *ctx, return false; } - if (items_in_d_stack < b->d_pops) { + if (UNLIKELY(items_in_d_stack < b->d_pops)) { lwan_status_error("Word `%.*s' requires %d item(s) in the D stack", (int)b->name_len, b->name, b->d_pops); return false; } - if (items_in_r_stack < b->r_pops) { + if (UNLIKELY(items_in_r_stack < b->r_pops)) { lwan_status_error("Word `%.*s' requires %d item(s) in the R stack", (int)b->name_len, b->name, b->r_pops); return false; @@ -207,7 +207,7 @@ static bool check_stack_effects(const struct forth_ctx *ctx, items_in_d_stack++; break; case OP_JUMP_IF: - if (!items_in_d_stack) { + if (UNLIKELY(!items_in_d_stack)) { lwan_status_error("Word `if' requires 1 item(s) in the D stack"); return false; }