summaryrefslogtreecommitdiff
path: root/ext/fiddle/conversions.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-13 09:35:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-13 09:35:10 +0000
commit34a0df159bd3754b9dbc467cf97dd6ed87f5f5e2 (patch)
treebd7636755f0d6d529fb6305fb9104f4209b818f9 /ext/fiddle/conversions.h
parentd10d5a974d81628605cf4d69b9e1a9b13fd43651 (diff)
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
Diffstat (limited to 'ext/fiddle/conversions.h')
-rw-r--r--ext/fiddle/conversions.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/fiddle/conversions.h b/ext/fiddle/conversions.h
index d0a08d6bc01..cbc610bad2e 100644
--- a/ext/fiddle/conversions.h
+++ b/ext/fiddle/conversions.h
@@ -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