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:
parent
b68ddcf30c
commit
95b0fed371
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
9
integer.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue