diff options
| author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-09 08:52:28 +0000 | 
|---|---|---|
| committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-09 08:52:28 +0000 | 
| commit | bd6fb54e3116b102670c980851af56461771545d (patch) | |
| tree | 71641a7d51b6bda43d61d02918d97068db09b55f /examples/factorial.asm | |
| parent | f896ad2cb714be6853ad7e0cec854d4295de5bed (diff) | |
| download | ovm-bd6fb54e3116b102670c980851af56461771545d.tar.gz ovm-bd6fb54e3116b102670c980851af56461771545d.tar.bz2 ovm-bd6fb54e3116b102670c980851af56461771545d.zip | |
Use constants in examples where possible
Stuff like numeric limits can be codified in constants which act self
documenting.
Diffstat (limited to 'examples/factorial.asm')
| -rw-r--r-- | examples/factorial.asm | 4 | 
1 files changed, 3 insertions, 1 deletions
| 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` | 
