Project

General

Profile

Bug #5991 ยป fiddle.diff

nobu (Nobuyoshi Nakada), 02/10/2012 12:38 AM

View differences:

w/ext/fiddle/conversions.c
return rb_ffi_type_of(long);
#if HAVE_LONG_LONG
case TYPE_LONG_LONG:
return rb_ffi_type_of(int64);
return rb_ffi_type_of(long_long);
#endif
case TYPE_FLOAT:
return &ffi_type_float;
......
dst->pointer = NUM2PTR(rb_Integer(src));
break;
case TYPE_CHAR:
dst->schar = NUM2INT(src);
if (signed_p)
dst->schar = NUM2INT(src);
else
dst->uchar = NUM2UINT(src);
break;
case TYPE_SHORT:
dst->sshort = NUM2INT(src);
if (signed_p)
dst->sshort = NUM2INT(src);
else
dst->ushort = NUM2UINT(src);
break;
case TYPE_INT:
dst->sint = NUM2INT(src);
if (signed_p)
dst->sint = NUM2INT(src);
else
dst->uint = NUM2UINT(src);
break;
case TYPE_LONG:
if (signed_p)
dst->slong = NUM2LONG(src);
else
dst->ulong = NUM2LONG(src);
dst->ulong = NUM2ULONG(src);
break;
#if HAVE_LONG_LONG
case TYPE_LONG_LONG:
dst->long_long = NUM2ULL(src);
if (signed_p)
dst->slong_long = NUM2LL(src);
else
dst->ulong_long = NUM2ULL(src);
break;
#endif
case TYPE_FLOAT:
......
return ULONG2NUM(retval.ulong);
#if HAVE_LONG_LONG
case TYPE_LONG_LONG:
return rb_ll2inum(retval.long_long);
if (signed_p) return LL2NUM(retval.slong_long);
return ULL2NUM(retval.ulong_long);
break;
#endif
case TYPE_FLOAT:
w/ext/fiddle/conversions.h
float ffloat; /* ffi_type_float */
double ddouble; /* ffi_type_double */
#if HAVE_LONG_LONG
unsigned LONG_LONG long_long; /* ffi_type_uint64 */
unsigned LONG_LONG ulong_long; /* ffi_type_ulong_long */
signed LONG_LONG slong_long; /* ffi_type_ulong_long */
#endif
void * pointer; /* ffi_type_pointer */
} fiddle_generic;
w/ext/fiddle/fiddle.h
# error "long size not supported"
# endif
#if HAVE_LONG_LONG
# if SIZEOF_LONG_LONG == 8
# define ffi_type_slong_long ffi_type_sint64
# define ffi_type_ulong_long ffi_type_uint64
# else
# error "long long size not supported"
# endif
#endif
#include <closure.h>
#include <conversions.h>
#include <function.h>
    (1-1/1)