shithub: riscv

Download patch

ref: 69298c79ab3da8164f9b5317be4ae1b2a75ab4dd
parent: 5aae3d344b9f362539f06d20ea5ca80a0c8b3a78
parent: 3c53021357e9ce86f77422877e36cdc73761e05b
author: cinap_lenrek <[email protected]>
date: Tue Apr 24 17:25:16 EDT 2018

merge

--- a/sys/include/sat.h
+++ b/sys/include/sat.h
@@ -106,3 +106,4 @@
 void satfree(SATSolve *);
 void satreset(SATSolve *);
 int satget(SATSolve *, int, int *, int);
+void satvafix(va_list);
--- a/sys/src/cmd/forp/cvt.c
+++ b/sys/src/cmd/forp/cvt.c
@@ -323,8 +323,8 @@
 	uint m;
 	int i, a, b, q;
 	
-	m = n1->size;
-	if(n2->size > m) m = n2->size;
+	m = n2->size;
+	if(n3->size > m) m = n3->size;
 	if(m > sz) m = sz;
 	nodevars(rn, m);
 	q = tologic(n1);
--- a/sys/src/cmd/forp/logic.c
+++ b/sys/src/cmd/forp/logic.c
@@ -46,6 +46,7 @@
 	va_list va;
 	
 	va_start(va, sat);
+	satvafix(va);
 	r = satand1(sat, (int*)va, -1);
 	va_end(va);
 	return r;
@@ -90,6 +91,7 @@
 	int r;
 	
 	va_start(va, sat);
+	satvafix(va);
 	r = sator1(sat, (int*)va, -1);
 	va_end(va);
 	return r;
@@ -267,6 +269,7 @@
 	int r;
 	
 	va_start(va, op);
+	satvafix(va);
 	r = satlogic1(sat, op, (int*)va, -1);
 	va_end(va);
 	return r;
--- a/sys/src/libsat/satadd.c
+++ b/sys/src/libsat/satadd.c
@@ -217,6 +217,21 @@
 	return s;
 }
 
+void
+satvafix(va_list va)
+{
+	int *d;
+	uintptr *s;
+
+	if(sizeof(int)==sizeof(uintptr)) return;
+	d = (int *) va;
+	s = (uintptr *) va;
+	do
+		*d++ = *s;
+	while((int)*s++ != 0);
+		
+}
+
 SATSolve *
 sataddv(SATSolve *s, ...)
 {
@@ -224,6 +239,7 @@
 	
 	va_start(va, s);
 	/* horrible hack */
+	satvafix(va);
 	s = satadd1(s, (int*)va, -1);
 	va_end(va);
 	return s;
--- a/sys/src/libsat/satrange.c
+++ b/sys/src/libsat/satrange.c
@@ -62,6 +62,7 @@
 	
 	va_start(va, max);
 	/* horrible hack */
+	satvafix(va);
 	s = satrange1(s, (int*)va, -1, min, max);
 	va_end(va);
 	return s;