* ext/dl/dl_conversions.c (rb_dl_type_to_ffi_type): support signed
long long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f953483787
commit
711ed72b79
@ -1,4 +1,7 @@
|
|||||||
Wed Feb 17 14:26:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Feb 17 15:34:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/dl/dl_conversions.c (rb_dl_type_to_ffi_type): support signed
|
||||||
|
long long.
|
||||||
|
|
||||||
* ext/dl/cfunc.c (rb_dlcfunc_inspect): get rid of overflow.
|
* ext/dl/cfunc.c (rb_dlcfunc_inspect): get rid of overflow.
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <dl_conversions.h>
|
#include <dl_conversions.h>
|
||||||
|
|
||||||
ffi_type * rb_dl_type_to_ffi_type(int dl_type)
|
ffi_type *
|
||||||
|
rb_dl_type_to_ffi_type(int dl_type)
|
||||||
{
|
{
|
||||||
int signed_p = 1;
|
int signed_p = 1;
|
||||||
|
|
||||||
@ -9,23 +10,24 @@ ffi_type * rb_dl_type_to_ffi_type(int dl_type)
|
|||||||
signed_p = 0;
|
signed_p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define rb_ffi_type_of(t) (signed_p ? &ffi_type_s##t : &ffi_type_u##t)
|
||||||
|
|
||||||
switch (dl_type) {
|
switch (dl_type) {
|
||||||
case DLTYPE_VOID:
|
case DLTYPE_VOID:
|
||||||
return &ffi_type_void;
|
return &ffi_type_void;
|
||||||
case DLTYPE_VOIDP:
|
case DLTYPE_VOIDP:
|
||||||
return &ffi_type_pointer;
|
return &ffi_type_pointer;
|
||||||
case DLTYPE_CHAR:
|
case DLTYPE_CHAR:
|
||||||
return signed_p ? &ffi_type_schar : &ffi_type_uchar;
|
return rb_ffi_type_of(char);
|
||||||
case DLTYPE_SHORT:
|
case DLTYPE_SHORT:
|
||||||
return signed_p ? &ffi_type_sshort : &ffi_type_ushort;
|
return rb_ffi_type_of(short);
|
||||||
case DLTYPE_INT:
|
case DLTYPE_INT:
|
||||||
return signed_p ? &ffi_type_sint : &ffi_type_uint;
|
return rb_ffi_type_of(int);
|
||||||
case DLTYPE_LONG:
|
case DLTYPE_LONG:
|
||||||
return signed_p ? &ffi_type_slong : &ffi_type_ulong;
|
return rb_ffi_type_of(long);
|
||||||
#if HAVE_LONG_LONG
|
#if HAVE_LONG_LONG
|
||||||
case DLTYPE_LONG_LONG:
|
case DLTYPE_LONG_LONG:
|
||||||
return &ffi_type_uint64;
|
return rb_ffi_type_of(int64);
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case DLTYPE_FLOAT:
|
case DLTYPE_FLOAT:
|
||||||
return &ffi_type_float;
|
return &ffi_type_float;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user