[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bit-extract seems broken.
From: |
Martin Grabmueller |
Subject: |
Re: bit-extract seems broken. |
Date: |
Tue, 19 Dec 2000 18:35:10 +0100 |
> From: Dirk Herrmann <address@hidden>
> Date: Tue, 19 Dec 2000 17:25:57 +0100 (MET)
>
> I just wanted to fix it, but realized that it is not really clear to me
> what bit-extract should do with negative numbers. Opinions? Should we
> for example only allow non-negative arguments?
I'd say: Forbid negative arguments. The only interpretation I could
imagine would be `count from the left', but since bignums are allowed
that does not make much sense.
> Further, I stumbled across what I think is a gcc compiler error on sparc
> solaris: x << y or x >> y appears to always give the same results if
> y = a + b*32, no matter what b is. In other words, the shift operation
> only uses the last 5 bits of the operand. I assume that this does not
> conform to the C standard? If anyone can confirm this, I will send a bug
> report.
I don't have any C standard documents handy, but my SPARC manual
confirms what you experienced. The shift instructions only use the 5
least significant bits of the operand register/constant. So GCC
should combine some of those instructions if a greater shift is
needed. But of course, this should only be a poblem for 64 bit
machines, and my manual is an old one for 32 bit SPARCs.
'mgrabmue
--
Martin Grabmueller address@hidden
http://www.pintus.de/mgrabmue/ address@hidden on EFnet