From e361a51248ca4cdea89395d53b24e98d9b1805a2 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 19 Aug 2015 10:47:27 -0400 Subject: new NAlign constant and fix frame size computation --- lisc/tools/slot.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lisc/tools/slot.c') diff --git a/lisc/tools/slot.c b/lisc/tools/slot.c index 4b97be7..caee851 100644 --- a/lisc/tools/slot.c +++ b/lisc/tools/slot.c @@ -14,7 +14,7 @@ #define VARL 1 -enum { N = 3 }; +enum { NAlign = 3 }; static int slota(int sz, int al, int *sa) @@ -31,18 +31,18 @@ slota(int sz, int al, int *sa) * todo, could sophisticate */ l = (l + a-1) & ~(a-1); - s = sa[N-1] + l; + s = sa[NAlign-1] + l; ret = s; - for (j=0, k=1; j sa[j+1]) { + if (j < NAlign-1 && s > sa[j+1]) { /* we were in a bigger hole, * it needs to shift further */ @@ -75,7 +75,7 @@ enum { S = 300 }; int main(int ac, char *av[]) { - int sa[N] = {0, 0, 2}; + int sa[NAlign] = {0, 0, 2}; char stk[S] = {0}, buf[4] = {0}; unsigned seed; int i, a, l, s, itr; @@ -97,7 +97,7 @@ main(int ac, char *av[]) printf("\n"); do a = rand() % 4; - while (a >= N); + while (a >= NAlign); if ((float)rand()/RAND_MAX < 0.1 && VARL) { l = rand() % (S/20); printf("[(%02d) %02d %d] ", itr, l, a); @@ -135,7 +135,7 @@ end: for (i=0; i