1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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].
This commit is contained in:
Takashi Kokubun 2020-06-20 14:55:09 -07:00 committed by GitHub
parent b68ddcf30c
commit 95b0fed371
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2020-06-21 06:55:43 +09:00
Merged-By: k0kubun <takashikkbn@gmail.com>
8 changed files with 44 additions and 8 deletions

9
integer.rb Normal file
View file

@ -0,0 +1,9 @@
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