summary refs log tree commit diff
path: root/fold.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-12 13:44:50 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-12 14:51:50 -0400
commite562f219cf4abb9219f0cbd8d5c423603ce66cad (patch)
tree7dc2ef229c2438dec0818105374d780a204561cf /fold.c
parent4ce295adadc67f66b01b1841db394f60dda3956b (diff)
downloadroux-e562f219cf4abb9219f0cbd8d5c423603ce66cad.tar.gz
oops, dumb bug in folding
Diffstat (limited to 'fold.c')
-rw-r--r--fold.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fold.c b/fold.c
index c507101..253c52e 100644
--- a/fold.c
+++ b/fold.c
@@ -24,9 +24,9 @@ czero(Con *c, int w)
 	if (c->type != CBits)
 		return 0;
 	if (w)
-		return !c->bits.i;
+		return c->bits.i == 0;
 	else
-		return !(uint32_t)c->bits.i;
+		return (uint32_t)c->bits.i == 0;
 }
 
 static int
@@ -291,9 +291,9 @@ fold(Fn *fn)
 		renref(&b->jmp.arg, fn);
 		if (b->jmp.type == JJnz && rtype(b->jmp.arg) == RCon) {
 				b->jmp.type = JJmp;
-				b->jmp.arg = R;
 				if (czero(&fn->con[b->jmp.arg.val], 0))
 					b->s1 = b->s2;
+				b->jmp.arg = R;
 				b->s2 = 0;
 		}
 		pb = &b->link;