shithub: femtolisp

Download patch

ref: 86c9e1f8aa7006dfa78137bf2f7e32ed4129eaf6
parent: 952cbd7aae1f071aaced832bb89a8009624b9d75
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Mar 10 09:44:43 EST 2023

fix plan 9 build

--- a/flmain.c
+++ b/flmain.c
@@ -1,6 +1,7 @@
 #ifdef PLAN9
 #include <u.h>
 #include <libc.h>
+#define snprintf snprint
 #else
 #include <stdio.h>
 #include <stdlib.h>
--- a/llt/dtypes.h
+++ b/llt/dtypes.h
@@ -147,11 +147,14 @@
 typedef s16int int16_t;
 typedef s32int int32_t;
 typedef s64int int64_t;
-typedef u64int uint64_t;
 typedef u8int u_int8_t;
 typedef u16int u_int16_t;
 typedef u32int u_int32_t;
 typedef u64int u_int64_t;
+typedef u8int uint8_t;
+typedef u16int uint16_t;
+typedef u32int uint32_t;
+typedef u64int uint64_t;
 typedef vlong off_t;
 typedef intptr intptr_t;
 typedef uintptr uintptr_t;
--- a/operators.c
+++ b/operators.c
@@ -12,6 +12,7 @@
 {
     return modf(arg, NULL);
 }
+#define isnan(x) isNaN(x)
 #else
 extern double trunc(double x);
 STATIC_INLINE double fpart(double arg)
@@ -179,11 +180,7 @@
     case T_INT64:  return *(int64_t*)a < *(int64_t*)b;
     case T_UINT64: return *(uint64_t*)a < *(uint64_t*)b;
     case T_FLOAT:  return *(float*)a < *(float*)b;
-    case T_DOUBLE: return *(double*)a < *(double*)b
-#ifdef PLAN9
-    && !isnan(*(double*)a) && !isnan(*(double*)b)
-#endif
-    ;
+    case T_DOUBLE: return *(double*)a < *(double*)b;
     }
     return 0;
 }
@@ -200,11 +197,7 @@
     case T_INT64:  return *(int64_t*)a == *(int64_t*)b;
     case T_UINT64: return *(uint64_t*)a == *(uint64_t*)b;
     case T_FLOAT:  return *(float*)a == *(float*)b;
-    case T_DOUBLE: return *(double*)a == *(double*)b
-#ifdef PLAN9
-    && !isnan(*(double*)a)
-#endif
-    ;
+    case T_DOUBLE: return *(double*)a == *(double*)b;
     }
     return 0;
 }
@@ -216,11 +209,6 @@
 
     double da = conv_to_double(a, atag);
     double db = conv_to_double(b, btag);
-
-#ifdef PLAN9
-    if (isnan(da) || isnan(db))
-        return 0;
-#endif
 
     // casting to double will only get the wrong answer for big int64s
     // that differ in low bits
--- a/print.c
+++ b/print.c
@@ -1,5 +1,4 @@
 #ifdef PLAN9
-#define isnan isNaN
 #define snprintf snprint
 int iswprint(u32int c);
 #endif