Skip to content

Commit

Permalink
Sprinkle some UNLIKELY() macros in check_stack_effects()
Browse files Browse the repository at this point in the history
  • Loading branch information
lpereira committed Feb 1, 2025
1 parent c1eeae6 commit 03b058a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/samples/forthsalon/forth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 03b058a

Please sign in to comment.