summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-28 09:09:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-28 09:09:18 +0000
commitfe6cf485e6e1d23766a81246e825b61eb534c176 (patch)
treecd029232507a85ab6612cb1a2383ae95d297ad98 /enum.c
parent98273af3f7d0ea445a18d39f1e359c74b0cfb045 (diff)
enum.c: Fixnum only
* enum.c (limit_by_enum_size, enum_size_over_p): check only against Fixnum size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/enum.c b/enum.c
index 2e78d08..6c68240 100644
--- a/enum.c
+++ b/enum.c
@@ -319,17 +319,17 @@ limit_by_enum_size(VALUE obj, long n)
{
unsigned long limit;
VALUE size = rb_check_funcall(obj, id_size, 0, 0);
- if (size == Qundef) return n;
- limit = NUM2ULONG(size);
- return ((unsigned long)n > limit) ? limit : n;
+ if (!FIXNUM_P(size)) return n;
+ limit = FIX2ULONG(size);
+ return ((unsigned long)n > limit) ? (long)limit : n;
}
static int
enum_size_over_p(VALUE obj, long n)
{
VALUE size = rb_check_funcall(obj, id_size, 0, 0);
- if (size == Qundef) return 0;
- return ((unsigned long)n > NUM2ULONG(size));
+ if (!FIXNUM_P(size)) return 0;
+ return ((unsigned long)n > FIX2ULONG(size));
}
/*