ref: 29f03ba4e74ec58b87e3e6470aadfb58ee804f48
parent: 8666ec6b555ec21e8c81089148527913febc7e53
author: aiju <devnull@localhost>
date: Tue Apr 24 08:20:07 EDT 2018
libsat, forp: fix va_list hack on amd64
--- 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/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;