Front page | perl.perl6.internals |
Postings from October 2002
Re: C# and Parrot
Thread Previous
From:
Dan Sugalski
Date:
October 18, 2002 13:46
Subject:
Re: C# and Parrot
Message ID:
a05111b0bb9d62274751f@[63.120.19.221]
At 1:38 PM +0100 10/18/02, Simon Cozens wrote:
>rweather@zip.com.au (Rhys Weatherley) writes:
>> int x = ...;
>> int y = (short)x;
>>
>> The value of x is truncated to 16 bits, and then sign-extended
>> to int. I'm looking for something like the "conv.i2" instruction
>> in IL, or "i2s" in JVM.
>
>One concievable way to do that is basically have the hypothetical
>CSInt and CSShort PMC classes know and care how many bits they're
>supposed to be, and handle overflow internally.
Yep, that's definitely a good way to do that. In many cases I think
it'll be the right way
>If need an op to do it, you can always provide a custom one. I think.
Alternately, we can have ops that act on I regs as 8, 16, 32 or,
maybe, 64 bit quantities. Dealing with I regs as 64 bit quantities on
a 32 bit system is somewhat problematic, as there are interesting
architectural issues. (Do you double up registers? If so, what about
systems that don't need it? Or do you keep a second set of
half-registers squirrelled away somewhere? Which is an interesting
problem in cache coherency, not to mention a hack)
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
dan@sidhe.org have teddy bears and even
teddy bears get drunk
Thread Previous