1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/integer.rb
Takashi Kokubun 95b0fed371
Make Integer#zero? a separated method and builtin (#3226)
A prerequisite to fix https://bugs.ruby-lang.org/issues/15589 with JIT.
This commit alone doesn't make a significant difference yet, but I thought
this commit should be committed independently.

This method override was discussed in [Misc #16961].
2020-06-20 14:55:09 -07:00

9 lines
175 B
Ruby

class Integer
# call-seq:
# int.zero? -> true or false
#
# Returns +true+ if +num+ has a zero value.
def zero?
Primitive.cexpr! 'int_zero_p(self);'
end
end