summaryrefslogtreecommitdiff
path: root/src/runtime/rcomp.r
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-01-28 19:02:21 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-01-28 19:02:21 +0000
commitf627f77f23d1497c9e1f4269b5c8812d12b42f18 (patch)
tree708772d83a8355e25155cf233d5a9e38f8ad4d96 /src/runtime/rcomp.r
parent6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (diff)
downloadicon-upstream.tar.gz
Imported Upstream version 9.5.0upstream/9.5.0upstream
Diffstat (limited to 'src/runtime/rcomp.r')
-rw-r--r--src/runtime/rcomp.r45
1 files changed, 11 insertions, 34 deletions
diff --git a/src/runtime/rcomp.r b/src/runtime/rcomp.r
index 6cd0610..2ad3e35 100644
--- a/src/runtime/rcomp.r
+++ b/src/runtime/rcomp.r
@@ -35,8 +35,6 @@ dptr dp1, dp2;
switch (Type(*dp1)) {
-#ifdef LargeInts
-
case T_Integer:
if (Type(*dp2) != T_Lrgint) {
v1 = IntVal(*dp1);
@@ -56,20 +54,6 @@ dptr dp1, dp2;
return Equal;
return ((lresult > 0) ? Greater : Less);
-#else /* LargeInts */
-
- case T_Integer:
- v1 = IntVal(*dp1);
- v2 = IntVal(*dp2);
- if (v1 < v2)
- return Less;
- else if (v1 == v2)
- return Equal;
- else
- return Greater;
-
-#endif /* LargeInts */
-
case T_Coexpr:
/*
* Collate on co-expression id.
@@ -171,14 +155,15 @@ dptr dp1, dp2;
return ((lresult > 0) ? Greater : Less);
case T_External:
- /*
- * Collate these values according to the relative positions of
- * their blocks in the heap.
- */
- lresult = ((long)BlkLoc(*dp1) - (long)BlkLoc(*dp2));
- if (lresult == 0)
- return Equal;
- return ((lresult > 0) ? Greater : Less);
+ /*
+ * Call associated collation function.
+ */
+ {
+ struct descrip result = callextfunc(&extlcmp, dp1, dp2);
+ long ans = result.vword.integr;
+ if (ans == 0) return Equal;
+ return ans > 0 ? Greater : Less;
+ }
default:
syserr("anycmp: unknown datatype.");
@@ -201,17 +186,12 @@ dptr dp;
return 0;
case T_Integer:
return 1;
-
-#ifdef LargeInts
case T_Lrgint:
return 1;
-#endif /* LargeInts */
-
case T_Real:
return 2;
-
- /* string: return 3 (see above) */
-
+ /* String (handled above): /*
+ /* return 3; */
case T_Cset:
return 4;
case T_File:
@@ -285,12 +265,9 @@ dptr dp1, dp2;
result = (IntVal(*dp1) == IntVal(*dp2));
break;
-#ifdef LargeInts
case T_Lrgint:
result = (bigcmp(dp1, dp2) == 0);
break;
-#endif /* LargeInts */
-
case T_Real:
GetReal(dp1, rres1);