Skip to content

Instantly share code, notes, and snippets.

@samwgoldman
Created September 30, 2018 17:25
Show Gist options
  • Save samwgoldman/90de0102d22465c482a08281ba45f339 to your computer and use it in GitHub Desktop.
Save samwgoldman/90de0102d22465c482a08281ba45f339 to your computer and use it in GitHub Desktop.
index 3ef907960..5de2e0e85 100644
--- a/runtime/compare.c
+++ b/runtime/compare.c
@@ -133,7 +133,8 @@ static intnat do_compare_val(struct compare_stack* stk,
return Long_val(v1) - Long_val(v2);
/* Subtraction above cannot overflow and cannot result in UNORDERED */
#ifndef NO_NAKED_POINTERS
- if (Is_in_value_area(v2)) {
+ if (!Is_in_value_area(v2))
+ return LESS;
#endif
switch (Tag_val(v2)) {
case Forward_tag:
@@ -151,14 +152,12 @@ static intnat do_compare_val(struct compare_stack* stk,
}
default: /*fallthrough*/;
}
-#ifndef NO_NAKED_POINTERS
- }
-#endif
return LESS; /* v1 long < v2 block */
}
if (Is_long(v2)) {
#ifndef NO_NAKED_POINTERS
- if (Is_in_value_area(v1)) {
+ if (!Is_in_value_area(v1))
+ return GREATER;
#endif
switch (Tag_val(v1)) {
case Forward_tag:
@@ -176,9 +175,6 @@ static intnat do_compare_val(struct compare_stack* stk,
}
default: /*fallthrough*/;
}
-#ifndef NO_NAKED_POINTERS
- }
-#endif
return GREATER; /* v1 block > v2 long */
}
#ifndef NO_NAKED_POINTERS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment