Project

General

Profile

Bug #3861 » fiddle-sparcv9.patch

ngoto (Naohisa Goto), 08/08/2011 10:37 PM

View differences:

trunk/ext/fiddle/closure.c 2011-08-08 21:37:57.586535000 +0900
*(long *)resp = NUM2LONG(ret);
break;
case TYPE_CHAR:
*(char *)resp = NUM2INT(ret);
case TYPE_SHORT:
case TYPE_INT:
*(ffi_sarg *)resp = NUM2INT(ret);
break;
case TYPE_VOIDP:
*(void **)resp = NUM2PTR(ret);
break;
case TYPE_INT:
*(int *)resp = NUM2INT(ret);
break;
case TYPE_DOUBLE:
*(double *)resp = NUM2DBL(ret);
break;
trunk/ext/fiddle/conversions.c 2011-08-08 22:32:01.208345000 +0900
dst->pointer = NUM2PTR(rb_Integer(src));
break;
case TYPE_CHAR:
dst->schar = NUM2INT(src);
break;
case TYPE_SHORT:
dst->sshort = NUM2INT(src);
break;
case TYPE_INT:
dst->sint = NUM2INT(src);
break;
......
return rb_funcall(cPointer, rb_intern("[]"), 1,
PTR2NUM((void *)retval.pointer));
case TYPE_CHAR:
if (signed_p) return INT2NUM((char)retval.fffi_sarg);
return INT2NUM((unsigned char)retval.fffi_arg);
case TYPE_SHORT:
if (signed_p) return INT2NUM((short)retval.fffi_sarg);
return INT2NUM((unsigned short)retval.fffi_arg);
case TYPE_INT:
return INT2NUM(retval.sint);
if (signed_p) return INT2NUM((int)retval.fffi_sarg);
return UINT2NUM((unsigned int)retval.fffi_arg);
case TYPE_LONG:
if (signed_p) return LONG2NUM(retval.slong);
return ULONG2NUM(retval.ulong);
trunk/ext/fiddle/conversions.h 2011-08-08 21:40:43.368062000 +0900
typedef union
{
ffi_arg fffi_arg;
ffi_sarg fffi_sarg;
unsigned char uchar; /* ffi_type_uchar */
signed char schar; /* ffi_type_schar */
unsigned short ushort; /* ffi_type_sshort */
(1-1/3)