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,354 of 117,927   
   Krishna Myneni to Krishna Myneni   
   Re: DLSHIFT and DRSHIFT   
   26 Mar 24 19:57:49   
   
   From: krishna.myneni@ccreweb.org   
      
   On 3/26/24 17:01, Krishna Myneni wrote:   
   > Standard source definitions of DLSHIFT and DRSHIFT (double number left   
   > shift and right shift), over full shift range, per discussion in prior   
   > thread.   
   >   
   > Tests needed.   
      
   Just tested DLSHIFT and found weird things going on. Traced the problem   
   to LSHIFT.   
      
      
   kforth64   
      
   1 64 LSHIFT .  \ expected to get zero   
   1              \ instead, got 1   
      
   Then, I looked at the spec. for LSHIFT and, indeed, there is an   
   ambiguous condition for u >= BITS_PER_CELL .   
      
      
   6.1.1805   
   LSHIFT “l-shift”   
   CORE   
   ( x1 u – – x2 )   
   Perform a logical left shift of u bit-places on x1, giving x2. Put   
   zeroes into the least significant bits vacated by the shift. An   
   ambiguous condition exists if u is greater than or equal to the number   
   of bits in a cell.   
      
   Gforth does the same thing   
      
   1 64 LSHIFT .  1   
   1 65 LSHIFT .  2   
   etc.   
      
      
   We shouldn't have an ambiguous condition here because of some   
   idiosyncratic behavior of the SHL instruction!   
      
   u 64 LSHIFT should be zero on all systems with cell sizes up to 64 bits.   
      
   --   
   Krishna   
      
   --- 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