front
cinap_lenrek 2018-04-24 21:25:16 +02:00
commit 69298c79ab
5 changed files with 23 additions and 2 deletions

View File

@ -106,3 +106,4 @@ int satval(SATSolve *, int);
void satfree(SATSolve *);
void satreset(SATSolve *);
int satget(SATSolve *, int, int *, int);
void satvafix(va_list);

View File

@ -323,8 +323,8 @@ optern(Node *rn, Node *n1, Node *n2, Node *n3, uint sz)
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);

View File

@ -46,6 +46,7 @@ satandv(SATSolve *sat, ...)
va_list va;
va_start(va, sat);
satvafix(va);
r = satand1(sat, (int*)va, -1);
va_end(va);
return r;
@ -90,6 +91,7 @@ satorv(SATSolve *sat, ...)
int r;
va_start(va, sat);
satvafix(va);
r = sator1(sat, (int*)va, -1);
va_end(va);
return r;
@ -267,6 +269,7 @@ satlogicv(SATSolve *sat, u64int op, ...)
int r;
va_start(va, op);
satvafix(va);
r = satlogic1(sat, op, (int*)va, -1);
va_end(va);
return r;

View File

@ -217,6 +217,21 @@ satadd1(SATSolve *s, int *a, int n)
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 @@ sataddv(SATSolve *s, ...)
va_start(va, s);
/* horrible hack */
satvafix(va);
s = satadd1(s, (int*)va, -1);
va_end(va);
return s;

View File

@ -62,6 +62,7 @@ satrangev(SATSolve *s, int min, int max, ...)
va_start(va, max);
/* horrible hack */
satvafix(va);
s = satrange1(s, (int*)va, -1, min, max);
va_end(va);
return s;