bf: added notes regarding '{' and '<'.
This commit is contained in:
4
src/bf.c
4
src/bf.c
@@ -105,6 +105,8 @@ void program_execute(struct ProgramConcat *prg)
|
|||||||
switch (opcode)
|
switch (opcode)
|
||||||
{
|
{
|
||||||
case '<':
|
case '<':
|
||||||
|
// NOTE: We're doing a safe subtraction here, but maybe we should
|
||||||
|
// terminate execution if subtraction will overflow?
|
||||||
ctx.head0 = SAFE_SUB(ctx.head0, 1);
|
ctx.head0 = SAFE_SUB(ctx.head0, 1);
|
||||||
++ctx.ip;
|
++ctx.ip;
|
||||||
break;
|
break;
|
||||||
@@ -113,6 +115,8 @@ void program_execute(struct ProgramConcat *prg)
|
|||||||
++ctx.ip;
|
++ctx.ip;
|
||||||
break;
|
break;
|
||||||
case '{':
|
case '{':
|
||||||
|
// NOTE: We're doing a safe subtraction here, but maybe we should
|
||||||
|
// terminate execution if subtraction will overflow?
|
||||||
ctx.head1 = SAFE_SUB(ctx.head1, 1);
|
ctx.head1 = SAFE_SUB(ctx.head1, 1);
|
||||||
++ctx.ip;
|
++ctx.ip;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user