On Mon, Nov 25, 2002 at 05:40:36PM +0100, Leopold Toetsch wrote:
> Nicholas Clark wrote:
> > I'm surprised that you did your regression tests longhand, rather than having
> > a data table in perl of input and expected output, and auto-generating parrot
> > code.
>
>
> Writing a few explicit tests is faster ;-)
Good answer.
When I have tuits (little white things made of ice, commonly found in hell)
I'll re-write your tests as autogenerated from a table of pathological cases.
> > Is there any speed advantage in truncating by casting via a C type
> > [eg a = (int)(short) b]
> > rather than and on a bitmask
> > [eg a = b & 0xFFFF]
> > ?
>
>
> gcc uses MOVSX (movs{b,w}l), move byte/word with sign extend to 32 bit.
> This is listed to take 3 cycles which "and mem" needs too. Inkluding
> sign extension would be slower then.
and gcc's optimiser is not clever enough to spot bit & cases that are not
equivalent to this? :-(
> > We're going to have to do that latter to make it work on Crays anyway, so is
> > a conditional compile to chose between the two worth it?
>
>
> My Cray is currently out of order ;-) What is special with it?
sizeof(short) == 8
[sizeof (int) == 8 for that matter, and the elements of a sockaddr_in
structure are bitfields, so you can't take the address of them.]
Nicholas Clark