Feature #10728 » fixnum-size-warning.patch
lib/rake/application.rb (working copy) | ||
---|---|---|
"(default is number of CPU cores + 4)",
|
||
lambda { |value|
|
||
if value.nil? || value == ''
|
||
value = FIXNUM_MAX
|
||
value = 2**32
|
||
elsif value =~ /^\d+$/
|
||
value = value.to_i
|
||
else
|
||
... | ... | |
backtrace.find { |str| str =~ re } || ''
|
||
end
|
||
private
|
||
FIXNUM_MAX = (2**(0.size * 8 - 2) - 1) # :nodoc:
|
||
end
|
||
end
|
numeric.c (working copy) | ||
---|---|---|
* 1.size #=> 4
|
||
* -1.size #=> 4
|
||
* 2147483647.size #=> 4
|
||
*
|
||
* This method will be changed in future.
|
||
* Use RbConfig::SIZEOF['long'] instead:
|
||
*
|
||
* require 'rbconfig/sizeof'
|
||
* RbConfig::SIZEOF['long'] #=> 4
|
||
*
|
||
*/
|
||
static VALUE
|
||
fix_size(VALUE fix)
|
||
{
|
||
rb_warn("Use RbConfig::SIZEOF['long'] instead of Fixnum#size");
|
||
return INT2FIX(sizeof(long));
|
||
}
|
||
test/ruby/test_enumerator.rb (working copy) | ||
---|---|---|
require 'test/unit'
|
||
require 'rbconfig/sizeof'
|
||
class TestEnumerator < Test::Unit::TestCase
|
||
def setup
|
||
... | ... | |
def test_with_index_large_offset
|
||
bug8010 = '[ruby-dev:47131] [Bug #8010]'
|
||
s = 1 << (8*1.size-2)
|
||
s = 1 << (8*RbConfig::SIZEOF['long']-2)
|
||
assert_equal([[1,s],[2,s+1],[3,s+2]], @obj.to_enum(:foo, 1, 2, 3).with_index(s).to_a, bug8010)
|
||
s <<= 1
|
||
assert_equal([[1,s],[2,s+1],[3,s+2]], @obj.to_enum(:foo, 1, 2, 3).with_index(s).to_a, bug8010)
|
- « Previous
- 1
- 2
- Next »