Skip to content

Commit

Permalink
stress-skiplist: add some UNLIKELY branch hints
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
  • Loading branch information
ColinIanKing committed Jan 29, 2025
1 parent 9869651 commit f4ab463
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stress-skiplist.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static int OPTIMIZE3 stress_skiplist(stress_args_t *args)
for (i = 0; i < n; i++) {
const unsigned long int v = (i >> 1) ^ i;

if (!skip_list_insert(&list, v)) {
if (UNLIKELY(!skip_list_insert(&list, v))) {
pr_inf("%s: out of memory initializing the skip list\n",
args->name);
skip_list_free(&list);
Expand All @@ -257,7 +257,7 @@ static int OPTIMIZE3 stress_skiplist(stress_args_t *args)
for (i = 0; i < n; i++) {
const unsigned long int v = (i >> 1) ^ i;

if (!skip_list_search(&list, v)) {
if (UNLIKELY(!skip_list_search(&list, v))) {
pr_fail("%s node containing value %lu was not found\n",
args->name, v);
rc = EXIT_FAILURE;
Expand Down

0 comments on commit f4ab463

Please sign in to comment.