Re: May the numbers speak - supplement

Liste des GroupesRevenir à cl forth 
Sujet : Re: May the numbers speak - supplement
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forth
Date : 12. Jun 2025, 12:04:46
Autres entêtes
Organisation : novaBBS
Message-ID : <87f0b8fea5b562a56a25da80572f94c4@www.novabbs.com>
References : 1 2 3 4 5 6 7 8
User-Agent : Rocksolid Light
On Thu, 12 Jun 2025 9:59:56 +0000, Paul Rubin wrote:

This version with the string in memory, no error checking, and using a
variable, seems simplest to me.
>
variable p
: advance ( -- ) 1 p +! ;
: digit ( -- n ) p @ c@ '0' - advance ;
: 2digit ( -- n ) digit 10 * digit + ;
: hms ( a u -- h m s ) drop p !
   2digit advance 2digit advance 2digit advance ;
It doesn't do the same thing. It isn't faster, which points out
the '60 *' and 'M* D+' are not the limiting factors.
: TEST ( --  )
  CR ." \ dtimescan   : " S" 12:34:56" TICKS-RESET dtimescan
     TICKS? UD. ." clock ticks elapsed, " UD.
  CR ." \ timestrscan : " S" 12:34:56" TICKS-RESET timestrscan
     TICKS? UD. ." clock ticks elapsed, " UD.
  CR ." \ HMS         : " S" 12:34:56" TICKS-RESET hms
     TICKS? UD. ." clock ticks elapsed, " ROT . SWAP . . ;
FORTH> TEST TEST TEST TEST
\ dtimescan   : 1257 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ HMS         : 419 clock ticks elapsed, 12 34 56
\ dtimescan   : 419 clock ticks elapsed, 45296
\ timestrscan : 420 clock ticks elapsed, 45296
\ HMS         : 0 clock ticks elapsed, 12 34 56
\ dtimescan   : 419 clock ticks elapsed, 45296
\ timestrscan : 419 clock ticks elapsed, 45296
\ HMS         : 419 clock ticks elapsed, 12 34 56
\ dtimescan   : 419 clock ticks elapsed, 45296
\ timestrscan : 420 clock ticks elapsed, 45296
\ HMS         : 419 clock ticks elapsed, 12 34 56  ok
FORTH> ' hms idis
$01466000  : hms
$0146600A  pop           rbx
$0146600B  pop           rbx
$0146600C  mov           $01463210 qword-offset, rbx
$01466013  mov           rbx, $01463210 qword-offset
$0146601A  movzx         rbx, [rbx] byte
$0146601D  add           $01463210 qword-offset, 1 b#
$01466025  lea           rbx, [rbx #-48 +] qword
$01466029  lea           rbx, [rbx rbx*4] qword
$0146602D  mov           rdi, $01463210 qword-offset
$01466034  movzx         rdi, [rdi] byte
$01466038  add           $01463210 qword-offset, 1 b#
$01466040  add           $01463210 qword-offset, 1 b#
$01466048  mov           rax, $01463210 qword-offset
$0146604F  movzx         rax, [rax] byte
$01466052  add           $01463210 qword-offset, 1 b#
$0146605A  lea           rax, [rax #-48 +] qword
$0146605E  lea           rax, [rax rax*4] qword
$01466062  mov           rdx, $01463210 qword-offset
$01466069  movzx         rdx, [rdx] byte
$0146606C  add           $01463210 qword-offset, 1 b#
$01466074  add           $01463210 qword-offset, 1 b#
$0146607C  mov           r9, $01463210 qword-offset
$01466083  movzx         r9, [r9 ] byte
$01466087  add           $01463210 qword-offset, 1 b#
$0146608F  lea           r9, [r9  #-48 +] qword
$01466093  lea           r9, [r9  r9*4 ] qword
$01466097  mov           r10, $01463210 qword-offset
$0146609E  movzx         r10, [r10] byte
$014660A2  add           $01463210 qword-offset, 1 b#
$014660AA  add           $01463210 qword-offset, 1 b#
$014660B2  lea           rbx, [rdi rbx*2 #-48 +] qword
$014660B7  push          rbx
$014660B8  lea           rbx, [rdx rax*2 #-48 +] qword
$014660BD  push          rbx
$014660BE  lea           rbx, [r10 r9*2  #-48 +] qword
$014660C3  push          rbx
$014660C4  ;
-marcel

Date Sujet#  Auteur
11 Jun 25 * May the numbers speak32LIT
11 Jun 25 +* Re: May the numbers speak25LIT
11 Jun 25 i`* Re: May the numbers speak - supplement24LIT
11 Jun 25 i `* Re: May the numbers speak - supplement23minforth
12 Jun 25 i  `* Re: May the numbers speak - supplement22dxf
12 Jun 25 i   `* Re: May the numbers speak - supplement21Paul Rubin
12 Jun 25 i    +- Re: May the numbers speak - supplement1LIT
12 Jun 25 i    +* Re: May the numbers speak - supplement8mhx
12 Jun 25 i    i`* Re: May the numbers speak - supplement7Paul Rubin
12 Jun 25 i    i +* Re: May the numbers speak - supplement5mhx
12 Jun 25 i    i i`* Re: May the numbers speak - supplement4Paul Rubin
13 Jun 25 i    i i `* Re: May the numbers speak - supplement3mhx
13 Jun 25 i    i i  `* Re: May the numbers speak - supplement2Paul Rubin
13 Jun 25 i    i i   `- Re: May the numbers speak - supplement1mhx
13 Jun 25 i    i `- Re: May the numbers speak - supplement1dxf
12 Jun 25 i    +- Re: May the numbers speak - supplement1ahmed
12 Jun 25 i    +- Re: May the numbers speak - supplement1minforth
12 Jun 25 i    +* Re: May the numbers speak - supplement2B. Pym
12 Jun 25 i    i`- Re: May the numbers speak - supplement1Paul Rubin
12 Jun 25 i    +- Re: May the numbers speak - supplement1peter
12 Jun 25 i    `* Re: May the numbers speak - supplement6B. Pym
13 Jun 25 i     `* Re: May the numbers speak - supplement5dxf
13 Jun 25 i      +* Re: May the numbers speak - supplement3Hans Bezemer
13 Jun 25 i      i`* Re: May the numbers speak - supplement2Paul Rubin
14 Jun 25 i      i `- Re: May the numbers speak - supplement1dxf
15 Jun 25 i      `- Re: May the numbers speak - supplement1dxf
11 Jun 25 `* Re: May the numbers speak6dxf
11 Jun 25  `* Re: May the numbers speak5Hans Bezemer
12 Jun 25   +- Re: May the numbers speak1dxf
12 Jun 25   `* Re: May the numbers speak3sean
12 Jun 25    +- Re: May the numbers speak1mhx
12 Jun 25    `- Re: May the numbers speak1minforth

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal