From bd6fb54e3116b102670c980851af56461771545d Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 9 Nov 2023 08:52:28 +0000 Subject: Use constants in examples where possible Stuff like numeric limits can be codified in constants which act self documenting. --- examples/factorial.asm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/factorial.asm') diff --git a/examples/factorial.asm b/examples/factorial.asm index 76e80b5..021360b 100644 --- a/examples/factorial.asm +++ b/examples/factorial.asm @@ -1,6 +1,8 @@ ;;; factorial.asm: A program that generates the factorials of each ;;; number from 1 to 24 (24!~=UINT64_MAX). Using the registers to ;;; store `n` and `n!`. + ;; Constants + %const(limit) 22 %end ;; Setup entrypoint global main @@ -38,7 +40,7 @@ loopback: mult.word mov.word 1 - push.word 24 + push.word $limit push.reg.word 0 gte.word ;; Jump to `loopback` -- cgit v1.2.3-13-gbd6f