Gopal V wrote:

Thanks for the patch. I'll add some config methods and apply it after polishing.


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 ..

Pretty well done, modulo minor typos, which a *test* would have catched ;-) hint, hint t/op/*.t ...

Ok, here we go.


inline op conv_i1(inout INT) {
  $1= (int)((char)($1));

  $1 = (INTVAL)((char)($1));


The INTVAL could be a "long long".


inline op conv_i2(inout INT) {
  $1= (int)((short)($1));

$1 = (INTVAL)((Parrot_int2)($1));


Parrot_Int2 will be generated by a test in config/auto/somewhere and will be "short".


inline op conv_i8(out PMC, in INT) {

inline op conv_i8(inout PMC, in INT) {

"inout", because the PMC has to exist in advance, and isn't emerging new here, like an int or num.

inline op conv_i8(out PMC, in NUM) {
  $1->vtable->set_integer_native(interpreter, $1,(int)$2);

  $1->vtable->set_integer_native(interpreter, $1, $2);

The vtable function has to do the conversion.


inline op conv_r4(out NUM, in INT) {
  $1=  (FLOATVAL)($1);

inline op conv_r4(out NUM, in INT) {
  $1 = (FLOATVAL)(float)($2);
                         ^^

leo

Reply via email to