mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
conversions.h: PTR2NUM
* ext/fiddle/conversions.h (PTR2NUM): use signed integer to make Fixnum for negative values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d10d5a974d
commit
34a0df159b
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Dec 13 18:35:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/fiddle/conversions.h (PTR2NUM): use signed integer to make
|
||||
Fixnum for negative values.
|
||||
|
||||
Sun Dec 13 18:33:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* pack.c (pack_pack): always check index range against the
|
||||
|
|
|
@ -33,11 +33,11 @@ VALUE generic_to_value(VALUE rettype, fiddle_generic retval);
|
|||
#define GENERIC2VALUE(_type, _retval) generic_to_value((_type), (_retval))
|
||||
|
||||
#if SIZEOF_VOIDP == SIZEOF_LONG
|
||||
# define PTR2NUM(x) (ULONG2NUM((unsigned long)(x)))
|
||||
# define PTR2NUM(x) (LONG2NUM((long)(x)))
|
||||
# define NUM2PTR(x) ((void*)(NUM2ULONG(x)))
|
||||
#else
|
||||
/* # error --->> Ruby/DL2 requires sizeof(void*) == sizeof(long) to be compiled. <<--- */
|
||||
# define PTR2NUM(x) (ULL2NUM((unsigned long long)(x)))
|
||||
# define PTR2NUM(x) (LL2NUM((LONG_LONG)(x)))
|
||||
# define NUM2PTR(x) ((void*)(NUM2ULL(x)))
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue