Skip to content

How should loop syntax behave when passed zero #10

@takagi

Description

@takagi

The following code iterates DO-SOMETHING for 256 times, because loop syntax is compiled to a DECFSZ instruction and the result decrementing zero becomes 255.

(loop 0
  (do-something))

How should loop syntax behave when it is passed zero as its argument?

DECFSZ instruction
The contents of register ‘f’ are decremented. ... If the result is ‘1’, the next instruction is executed. If the result is ‘0’, then a NOP is executed instead, ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions