At 1:38 PM +0100 10/18/02, Simon Cozens wrote:
[EMAIL PROTECTED] (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
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk

Reply via email to