Introduce a 0.r word, suggested by Segher. Optimize r890 by using this helper.
Cc: Segher Boessenkool segher@kernel.crashing.org Signed-off-by: Andreas Färber andreas.faerber@web.de --- Segher, mind adding your SoB for 0.r? Thanks.
forth/admin/devices.fs | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/forth/admin/devices.fs b/forth/admin/devices.fs index dbb4646..b48e2f1 100644 --- a/forth/admin/devices.fs +++ b/forth/admin/devices.fs @@ -276,6 +276,11 @@ . ;
+\ Print a number zero-padded +: 0.r ( u minlen -- ) + 0 swap <# 1 ?do # loop #s #> type +; + : .p-bytes? ( data len -- 1 | data len 0 ) ." -- " dup . ." : " swap >r 0 @@ -283,7 +288,7 @@ dup r@ + c@ ( len n ch )
- pocket tohexstr dup 2 <> if ." 0" then type ." " + 2 0.r ." " 1+ repeat 2drop r> drop 1