Post Reply 
HP 48GX Indefinite Loops
04-03-2022, 02:39 AM
Post: #10
RE: HP 48GX Indefinite Loops
(03-29-2022 12:30 PM)DavidM Wrote:  I'm sure this could be optimized more (…)

Mostly copied but using local variables str and pos:
Code:
\<<
   { } SWAP
   WHILE                      @ check condition - position of linefeed
      DUP
      10 CHR POS
      DUP
   REPEAT \-> str pos         @ execute if linefeed found:
      \<<
         str 1 pos 1 - SUB +  @ SUB everything before the linefeed
         str pos 1 + 1E8 SUB  @ SUB everything after linefeed
      \>>
   END
   DROP                       @ DROP the 0 indicating no more linefeeds
   +
\>>

I try to avoid modifying local variables using STO.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 48GX Indefinite Loops - MNH - 03-28-2022, 01:11 AM
RE: HP 48GX Indefinite Loops - MNH - 04-02-2022, 02:15 PM
RE: HP 48GX Indefinite Loops - DavidM - 03-28-2022, 04:11 AM
RE: HP 48GX Indefinite Loops - DavidM - 03-29-2022, 12:30 PM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 01:59 AM
RE: HP 48GX Indefinite Loops - DavidM - 04-03-2022, 10:58 AM
RE: HP 48GX Indefinite Loops - DavidM - 04-03-2022, 11:39 AM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 05:39 PM
RE: HP 48GX Indefinite Loops - ttw - 03-30-2022, 01:02 AM
RE: HP 48GX Indefinite Loops - Thomas Klemm - 04-03-2022 02:39 AM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 12:57 PM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 04:25 PM



User(s) browsing this thread: 1 Guest(s)