develooper Front page | perl.perl6.internals | Postings from October 2002

Re: C# and Parrot

Thread Previous | Thread Next
From:
Simon Cozens
Date:
October 18, 2002 05:38
Subject:
Re: C# and Parrot
Message ID:
8665vz53df.fsf@squash.oucs.ox.ac.uk
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.

If need an op to do it, you can always provide a custom one. I think.

-- 
fga is frequently given answers... the best are "Date::Calc", "use a hash",
and "yes, it's in CPAN" or Data::Dumper or mySQL or "check your permissions"
or NO Fmh THAT'S WRONG or "You can't. crypt is one-way" or "yes, i'm single"
or "I think that's a faq." or substr! or "use split" or "man perlre" - #perl

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About