home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,406 of 117,927   
   albert@spenarnc.xs4all.nl to dxforth@gmail.com   
   Re: DLSHIFT and DRSHIFT   
   14 Apr 24 13:06:12   
   
   In article <661a5369$1@news.ausics.net>, dxf   wrote:   
   >On 12/04/2024 6:27 pm, albert@spenarnc.xs4all.nl wrote:   
   >> In article <66188ab1$1@news.ausics.net>, dxf   wrote:   
   >>> On 12/04/2024 1:11 am, albert@spenarnc.xs4all.nl wrote:   
   >>>>   
   >>>> While others indulge in endless discussions about DRSHIFT   
   >>>> I thought to attempt some literate programming.   
   >>>   
   >>> It didn't prompt you to test your own implementation?   
   >>>   
   >>>  ( D0= D0<> D0< D= D< D- M+ DRSHIFT DLSHIFT DU< ) \ AvdH B6Mar22   
   >>>   
   >>>  : DLSHIFT >R SWAP DUP R@ LSHIFT SWAP 8 CELLS R@ - RSHIFT ROT R>   
   >>>      LSHIFT OR ;   
   >>>   
   >>>  : DRSHIFT >R DUP R@ RSHIFT SWAP 8 CELLS R@ - LSHIFT ROT R>   
   >>>      RSHIFT OR SWAP ;   
   >>>   
   >>> 0 4 d. 17179869184  ok   
   >>> 0 4 0 drshift d. 17179869188  ok   
   >>>   
   >>> 4 0 d. 4  ok   
   >>> 4 0 0 dlshift d. 17179869188  ok   
   >>>   
   >>   
   >> Good catch! Shifting over 8 CELLS is an ambiguous condition.   
   >> insert   
   >>     DUP 0= IF EXIT THEN   
   >> in front of the code.   
   >   
   >That handles the specific case '0 shift' but the ambiguous condition   
   >you mention arises again here:   
   >   
   >HEX   
   >03  01  8 cells  dlshift .( Expected: 00 03  Got: ) swap u. u. cr   
   >FF  00  8 cells  dlshift .( Expected: 00 FF  Got: ) swap u. u. cr   
   >00  01  8 cells  drshift .( Expected: 01 00  Got: ) swap u. u. cr   
   >00  FF  8 cells  drshift .( Expected: FF 00  Got: ) swap u. u. cr   
   >DECIMAL   
      
   You are right. Totally annoyed with this. Changed the library to   
      
   : DLSHIFT 0 ?DO 2DUP D+ LOOP ;   
      
   : DRSHIFT 0 ?DO 2 UDM/MOD ROT DROP LOOP ;   
      
      
   Groetjes Albert   
   --   
   Don't praise the day before the evening. One swallow doesn't make spring.   
   You must not say "hey" before you have crossed the bridge. Don't sell the   
   hide of the bear until you shot it. Better one bird in the hand than ten in   
   the air. First gain is a cat purring.            - the Wise from Antrim -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca