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,397 of 117,927   
   Hans Bezemer to dxf   
   Re: DLSHIFT and DRSHIFT   
   07 Apr 24 14:53:12   
   
   From: the.beez.speaks@gmail.com   
      
   On 01-04-2024 03:22, dxf wrote:   
   > While your double-shift algorithm produces the correct results (not shown   
   here),   
   > the intermediate values presented to each RSHIFT/LSHIFT can be quite   
   out-of-bounds   
   > e.g. a shift of 40 and -20 (actually FFFFFFE0) would concern me.  That an   
   'unambiguous'   
   > RSHIFT/LSHIFT will mask questionable parameters fed to it and return a   
   result of 0,   
   > I for one find problematic.  IMO it were better that RSHIFT/LSHIFT should   
   fail than   
   > do this.   
      
   For those interested in the entire fixed routine, here it is:   
      
   : dlshift   
      dup 0> 0= if drop ;then   
      dup cell-bits - dup 0< 0= if >r drop drop r> lshift 0 swap ;then drop   
      >r over 0 invert cell-bits r@ - dup >r lshift and r> rshift swap   
      r@ lshift or swap r> lshift swap   
      
      
   : drshift   
      dup 0> 0= if drop ;then   
      dup cell-bits - dup 0< 0= if >r drop nip r> rshift 0 ;then drop   
      >r dup 0 invert cell-bits r@ - dup >r rshift and r> lshift swap   
      r@ rshift spin r> rshift or swap   
      
      
   : SPIN SWAP ROT ;   
   : ;THEN POSTPONE EXIT POSTPONE THEN ; IMMEDIATE   
      
   "cell-bits" should be obvious.   
      
   Hans Bezemer   
      
   --- 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