If memory serves me right, Gopal V wrote: > I couldn't make myself name it "dotnet".ops so named it dotgnu.ops ...
On nicholas' advice I'm writing out the expected results for all these opcodes... in the hope that someone more well versed in writing ..t files than me can help .. conv_i1 & conv_i1_ovf --------------------- Truncate to between (-128 and 127) so 128 converted to -128 ... 0 to 0 and the basic sign extensions of `char' apply here . 'ovf' suffix instruction throws an OverFlowException message if the value is not between -128 and 127. (TODO: throw catchable exceptions) conv_u1 & conv_u1_ovf --------------------- To between 0 and 255 ... ovf throws the OverFlowException if value not in range. Original post bugs out for 256 ... See attached patch conv_i2 & conv_i2_ovf --------------------- To between -32768 and 32767 .. ovf for out of range conv_u2 & conv_u2_ovf --------------------- To between 0 & 65535 ... ovf for out of range conv_i4 ------- NUM to int : 3.1415 to 3 , -3.1415 to 3 PMC to int (until csint64.pmc is done...try testing with perlint please ..) conv_u4 ------- NUM to unsigned int: 3.1415 to 3, -3.1415 is not 3 PMC to int (when csint64.pmc is done ...) conv_i8 ------- (int to csint64.pmc , NUM to csint64.pmc ...) conv_r4 ------- (PMC to floatval) ... to be implemented as csint64.pmc test 3 to 3.000 ... (not much of a test , eh ?) I'll try to catch up on PMC writing at leisure .. Gopal -- The difference between insanity and genius is measured by success
--- /tmp/dotgnu.ops Mon Nov 25 21:26:31 2002 +++ dotgnu.ops Mon Nov 25 21:27:02 2002 @@ -38,7 +38,7 @@ } inline op conv_u1_ovf(inout INT) { - if($1 >= 0 && $1 <= 256 ) { + if($1 >= 0 && $1 <= 255 ) { $1= (int)((unsigned char)($1)); } else {