summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-18 11:28:51 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-18 11:28:51 +0000
commit9cc1cc2045469323fdd97aaf0a17585db5686d69 (patch)
tree5ceee3f30dab9a4af684e1779cf3f105863b528d /ext/socket/mkconstants.rb
parent05c0a22854312d528965ef5866cf5d840b42bdad (diff)
* ext/socket/mkconstants.rb (INTEGER2NUM): Make less comparisons.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 51322b0..f1f450d 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