Skip to content

Commit

Permalink
fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
phillvancejr committed Jun 22, 2022
1 parent 1f76644 commit bdb3f54
Showing 1 changed file with 42 additions and 44 deletions.
86 changes: 42 additions & 44 deletions bf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ void interpret(char* src, size_t src_len) {
if (v <= 127)
printf("%c",v);
i++;
// TODO? special syscalls over 128?
break;
}
case ',':
Expand Down Expand Up @@ -218,52 +217,51 @@ int main() {
}
switch(c){
case '+':
cells[dp]++;
i++;
break;
case '-':
cells[dp]--;
i++;
break;
case '>':
dp += dp < MAX_CELLS ? 1 : 0;
i++;
break;
case '<':
dp -= dp > 0 ? 1 : 0;
i++;
break;
case '.': {
u8 v = cells[dp];
if (v <= 127)
printf("%c",v);
i++;
// TODO? special syscalls over 128?
break;
}
case ',':
if(dp < MAX_CELLS && dp >= 0)
cells[dp]=getchar();
i++;
break;
case '[':
if (cells[dp] == 0)
i = ops[i];
else
i++;
break;
case ']':
if (cells[dp] == 0)
i++;
else
case '+':
cells[dp]++;
i++;
break;
case '-':
cells[dp]--;
i++;
break;
case '>':
dp += dp < MAX_CELLS ? 1 : 0;
i++;
break;
case '<':
dp -= dp > 0 ? 1 : 0;
i++;
break;
case '.': {
u8 v = cells[dp];
if (v <= 127)
printf("%c",v);
i++;
break;
}
case ',':
if(dp < MAX_CELLS && dp >= 0)
cells[dp]=getchar();
i++;
break;
case '[':
if (cells[dp] == 0)
i = ops[i];
else
i++;
break;
// additions
case '~':
case ']':
if (cells[dp] == 0)
i++;
dump_cells(100);
break;
else
i = ops[i];
break;
// additions
case '~':
i++;
dump_cells(100);
break;
}
}
return 0;
Expand Down

0 comments on commit bdb3f54

Please sign in to comment.