diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-03-31 04:52:10 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-03-31 04:52:10 +0000 |
commit | a1d8147e4419d81cd93c664b85f7062c89101c87 (patch) | |
tree | 1fea18df7e29da5e86be6337f7fb8181ec044ff7 /numeric.c | |
parent | b41d6e177b44f13b2bfb190a7aae3dd2d5faf4ef (diff) |
eval(..,file,line);String#center
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -588,6 +588,18 @@ num2int(val) switch (TYPE(val)) { case T_FIXNUM: + if (sizeof(int) < sizeof(INT)) { +#ifndef INT_MAX +/* assuming 32bit(2's compliment) int */ +# define INT_MAX 2147483647 +# define INT_MIN (- INT_MAX - 1) +#endif + INT i = FIX2INT(val); + if (INT_MIN < i && i < INT_MAX) { + return i; + } + ArgError("Fixnum too big to convert into `int'"); + } return FIX2INT(val); case T_FLOAT: |