summary refs log tree commit diff
path: root/lisc/emit.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-19 10:47:27 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:32 -0400
commite361a51248ca4cdea89395d53b24e98d9b1805a2 (patch)
treef53642319f05ed5ac2174a9f85b1a0f264f71be6 /lisc/emit.c
parent61d07bbb147018cffd2120754c1f3f4f20f3f4dc (diff)
downloadroux-e361a51248ca4cdea89395d53b24e98d9b1805a2.tar.gz
new NAlign constant and fix frame size computation
Diffstat (limited to 'lisc/emit.c')
-rw-r--r--lisc/emit.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index ce39168..1f2060b 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -283,17 +283,16 @@ eins(Ins i, Fn *fn, FILE *f)
 static int
 framesz(Fn *fn)
 {
-	enum { N = sizeof (Fn){0}.svec / sizeof (Fn){0}.svec[0] };
 	int i, a, f;
 
 	f = 0;
-	for (i=N-1, a=1<<i; i>=0; i--, a/=2)
+	for (i=NAlign-1, a=1<<i; i>=0; i--, a/=2)
 		if (f == 0 || f - a == fn->svec[i])
 			f = fn->svec[i];
-	a = 1 << (N-2);
-	while (f % (2 * a) != a)
+	a = 1 << (NAlign-2);
+	while ((f + a) % (2 * a) != a)
 		f += a - f % a;
-	return f * 16 / (1 << (N-1));
+	return f * 16 / (1 << (NAlign-1));
 }
 
 void