aboutsummaryrefslogtreecommitdiffstats
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
parent05c0a22854312d528965ef5866cf5d840b42bdad (diff)
downloadruby-9cc1cc2045469323fdd97aaf0a17585db5686d69.tar.gz
* 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
-rw-r--r--ChangeLog4
-rw-r--r--ext/socket/mkconstants.rb14
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 329a694e88..df2c867f67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat May 18 20:28:12 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/mkconstants.rb (INTEGER2NUM): Make less comparisons.
+
Sat May 18 20:15:28 2013 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (str_scrub_bang): add String#scrub!. [Feature #8414]
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