From 29c3d2141831a8eb1bda9e22c3e38771176cf3ef Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 14 Dec 2017 09:42:07 +0100 Subject: Fix bug --- bfcomp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bfcomp.c b/bfcomp.c index 4039856..10aa0e9 100644 --- a/bfcomp.c +++ b/bfcomp.c @@ -238,14 +238,13 @@ void writeprogram(char *source,FILE *asmf,Sourcemap *sm){ do { char c=source[i]; if(addc&&c!='+'&&c!='-'){ - addc=(addc%256)+256%256; + addc=((addc%256)+256)%256; if(addc==1)fprintf(asmf,"\tinc byte [rbx] ; 1 +\n"); else if(addc==-1)fprintf(asmf,"\tdec byte [rbx] ; 1 -\n"); else fprintf(asmf,"\tadd byte [rbx], %d ; %d %c\n",addc,addc<0?-addc:addc,addc<0?'-':'+'); addc=0; } if(shiftc&&c!='>'&&c!='<'){ - shiftc=(shiftc%256)+256%256; if(params.lastcell){ if(lastshiftc>0&&shiftc<0){ int id=uniqid(); -- cgit v1.2.3-70-g09d2