[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lshift bug
From: |
Anton Ertl |
Subject: |
Re: lshift bug |
Date: |
Sat, 16 May 2020 18:06:04 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Sat, May 16, 2020 at 05:46:49PM +0200, Klaus Schleisiek wrote:
> Hallo Bernd,
>
> on 64-bit gforth_0.7.9_20200305 I enter:
>
> 1 &64 lshift <cr> 1 ok
>
> hm????
>
> I would expect 0 as you get with
>
> : lshift' ( u1 u2 -- u3 ) 0 ?DO 2* LOOP ;
From: <https://forth-standard.org/standard/core/LSHIFT>:
|An ambiguous condition exists if u [the shift count] is greater than
|or equal to the number of bits in a cell.
In Gforth, LSHIFT does what unsigned << does in gcc (it's undefined in
C, and AFAIK GNU C does not define it, either), which is typically
what the hardware does. On a lot of hardware, for 64-bit shifts only
the low-order 6 bits are passed to the shifter (i.e., shift by 64 is
equivalent to shift by 0).
- anton
- lshift bug, Klaus Schleisiek, 2020/05/16
- Re: lshift bug,
Anton Ertl <=
- Re: lshift bug, Klaus Schleisiek, 2020/05/17
- Re: lshift bug, Anton Ertl, 2020/05/17
- Re: lshift bug, Klaus Schleisiek, 2020/05/17
- Re: lshift bug, Bernd Paysan, 2020/05/17
- Re: lshift bug, Anton Ertl, 2020/05/18
- Re: lshift bug, Klaus Schleisiek, 2020/05/18