diff options
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r-- | ext/socket/mkconstants.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb index 51322b06c7..f1f450d6dd 100644 --- a/ext/socket/mkconstants.rb +++ b/ext/socket/mkconstants.rb @@ -280,13 +280,15 @@ result = ERB.new(<<'EOS', nil, '%').result(binding) <%= INTERN_DEFS.map {|vardef, gen_hash, decl, func| vardef }.join("\n") %> #ifdef HAVE_LONG_LONG -#define INTEGER2NUM(n) (0 < (n) ? \ - ((n) <= FIXNUM_MAX ? LONG2FIX(n) : ULL2NUM(n)) : \ - (FIXNUM_MIN <= (LONG_LONG)(n) ? LONG2FIX(n) : LL2NUM(n))) +#define INTEGER2NUM(n) \ + (FIXNUM_MAX < (n) ? ULL2NUM(n) : \ + FIXNUM_MIN > (LONG_LONG)(n) ? LL2NUM(n) : \ + LONG2FIX(n)) #else -#define INTEGER2NUM(n) (0 < (n) ? \ - ((n) <= FIXNUM_MAX ? LONG2FIX(n) : ULONG2NUM(n)) : \ - (FIXNUM_MIN <= (long)(n) ? LONG2FIX(n) : LONG2NUM(n))) +#define INTEGER2NUM(n) \ + (FIXNUM_MAX < (n) ? ULONG2NUM(n) : \ + FIXNUM_MIN > (long)(n) ? LONG2NUM(n) : \ + LONG2FIX(n)) #endif static void |