summaryrefslogtreecommitdiff
path: root/runtime/compare.c
diff options
context:
space:
mode:
authorSam Goldman <samwgoldman@gmail.com>2018-09-30 10:08:40 -0700
committerSam Goldman <samwgoldman@gmail.com>2018-10-02 08:32:39 -0700
commitc197465c2f274acf971e3e7dc3f65861c66a72f6 (patch)
tree3f0c7fe2b07c5322c65d917e53f882e882912894 /runtime/compare.c
parente8a726c0e2d46d9b1d277adc73aac4b37d92c441 (diff)
downloadocaml-c197465c2f274acf971e3e7dc3f65861c66a72f6.tar.gz
Consolidate NO_NAKED_POINTER checks
Diffstat (limited to 'runtime/compare.c')
-rw-r--r--runtime/compare.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/runtime/compare.c b/runtime/compare.c
index 3ef9079600..5de2e0e852 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