shithub: sl

Download patch

ref: 6c01031101ca8a2d027de6beec1e01a3262a5a88
parent: 7a9ca8d83215841cc5875516ac2499e9b4d076bb
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Mar 27 03:44:01 EDT 2025

TAG_NUM → TAG_FIXNUM

--- a/src/cvalues.c
+++ b/src/cvalues.c
@@ -564,9 +564,9 @@
 	argcount(nargs, 1);
 	switch(tag(args[0])){
 	case TAG_CONS: return sl_conssym;
-	case TAG_NUM: return sl_fixnumsym;
+	case TAG_FIXNUM: return sl_fixnumsym;
 	case TAG_SYM: return sl_symsym;
-	case TAG_VEC: return sl_vecsym;
+	case TAG_VEC:return sl_vecsym;
 	case TAG_FN:
 		if(args[0] == sl_t)
 			return sl_booleansym;
--- a/src/equal.c
+++ b/src/equal.c
@@ -16,7 +16,7 @@
 #endif
 
 // comparable tag
-#define cmptag(v) (isfixnum(v) ? TAG_NUM : tag(v))
+#define cmptag(v) (isfixnum(v) ? TAG_FIXNUM : tag(v))
 
 static sl_v
 eq_class(sl_htable *table, sl_v key)
@@ -80,7 +80,7 @@
 	int tagb = cmptag(b);
 	int c;
 	switch(taga){
-	case TAG_NUM :
+	case TAG_FIXNUM:
 		if(isfixnum(b))
 			return (sl_fx)a < (sl_fx)b ? fixnum(-1) : fixnum(1);
 		if(iscprim(b)){
@@ -331,7 +331,7 @@
 
 	*oob = false;
 	switch(tg){
-	case TAG_NUM :
+	case TAG_FIXNUM:
 		u.d = (double)numval(a);
 		return doublehash(u.i64);
 	case TAG_FN:
--- a/src/print.c
+++ b/src/print.c
@@ -421,7 +421,7 @@
 
 	int n;
 	switch(tag(v)){
-	case TAG_NUM:
+	case TAG_FIXNUM:
 		n = ios_printf(f, "%"PRIdFIXNUM, numval(v));
 		if(n < 1)
 			lerrorf(sl_errio, "write failed");
--- a/src/sl.h
+++ b/src/sl.h
@@ -11,7 +11,7 @@
 typedef struct sl_type sl_type;
 
 enum {
-	TAG_NUM,
+	TAG_FIXNUM,
 	TAG_CPRIM,
 	TAG_FN,
 	TAG_VEC,
@@ -108,7 +108,7 @@
 #define builtin(n) tagptr(((sl_v)n<<3), TAG_FN)
 #define iscons(x) (tag(x) == TAG_CONS)
 #define issym(x) (tag(x) == TAG_SYM)
-#define isfixnum(x) (((x)&3) == TAG_NUM)
+#define isfixnum(x) (tag(x) == TAG_FIXNUM)
 #define bothfixnums(x, y) (isfixnum(x) && isfixnum(y))
 #define isvec(x) (tag(x) == TAG_VEC)
 #define iscvalue(x) (tag(x) == TAG_CVALUE)