If memory serves me right, Rhys Weatherley wrote: > on 32-bit, 64-bit, and native-sized integer types (8-bit > types don't need it).
Hmm... maybe there's only one way to stop this loooong thread ... Oct 18 20:31:20 <Nicholas> no, no, you have it wrong. you don't *ask* us to add features. YOu just send us patches which do them :-) Nov 25 03:09:38 <Dan> And I'm serious. If you want a dotnet.ops file, go for it. ..... I couldn't make myself name it "dotnet".ops so named it dotgnu.ops ... DISCLAIMER: I don't know anything about how parrot opcodes should be written .. So all errors are accidental and I would like somebody to point them out to me .. Gopal -- The difference between insanity and genius is measured by success
/* ** dotgnu.ops */ #include "parrot/method_util.h" VERSION = PARROT_VERSION; =head1 NAME dotgnu.ops =cut =head1 DESCRIPTION Additional opcodes for C# compilation needed by cscc PM codegen =cut inline op conv_i1(inout INT) { $1= (int)((char)($1)); goto NEXT(); } inline op conv_i1_ovf(inout INT) { if($1 >= -128 && $1 <= 127) { $1= (int)((char)($1)); } else { internal_exception(1, "Overflow exception for conv_i1_ovf\n"); } goto NEXT(); } inline op conv_u1(inout INT) { $1= (int)((unsigned char)($1)); goto NEXT(); } inline op conv_u1_ovf(inout INT) { if($1 >= 0 && $1 <= 256 ) { $1= (int)((unsigned char)($1)); } else { internal_exception(1, "Overflow exception for conv_u1_ovf\n"); } goto NEXT(); } inline op conv_i2(inout INT) { $1= (int)((short)($1)); goto NEXT(); } inline op conv_i2_ovf(inout INT) { if($1 >= -32768 && $1 <= 32767 ) { $1= (int)((short)($1)); } else { internal_exception(1, "Overflow exception for conv_i2_ovf\n"); } goto NEXT(); } inline op conv_u2(inout INT) { $1= (int)((unsigned short)($1)); goto NEXT(); } inline op conv_u2_ovf(inout INT) { if($1 >= 0 && $1 <= 65535) { $1= (int)((unsigned short)($1)); } else { internal_exception(1, "Overflow exception for conv_u2_ovf\n"); } goto NEXT(); } inline op conv_i4(out INT, in NUM) { $1= (int)($2); goto NEXT(); } inline op conv_i4(out INT, in PMC) { $1= (int)($2->vtable->get_integer(interpreter, $2)); goto NEXT(); } inline op conv_u4(out INT, in NUM) { $1= (unsigned int)($2); goto NEXT(); } inline op conv_u4(out INT, in PMC) { $1= (unsigned int) ($2->vtable->get_integer(interpreter, $2)); goto NEXT(); } inline op conv_i8(out PMC, in INT) { $1->vtable->set_integer_native(interpreter, $1,$2); goto NEXT(); } inline op conv_i8(out PMC, in PMC) { $1->vtable->set_integer_same(interpreter, $1,$2); goto NEXT(); } inline op conv_i8(out PMC, in NUM) { $1->vtable->set_integer_native(interpreter, $1,(int)$2); goto NEXT(); } inline op conv_r4(out NUM, in INT) { $1= (FLOATVAL)($1); goto NEXT(); } inline op conv_r4(out NUM, in PMC) { $1= (FLOATVAL) ($2->vtable->get_number(interpreter, $2)); goto NEXT(); }