зеркало из https://github.com/github/ruby.git
ruby.h: unnormalized Fixnum value
* include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug on mingw/mswin. [ruby-core:82687] [Bug #13877] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0f25c6d7d5
Коммит
65b87de350
|
@ -384,7 +384,7 @@ BigDecimal_hash(VALUE self)
|
|||
hash ^= rb_memhash(p->frac, sizeof(BDIGIT)*p->Prec);
|
||||
hash += p->exponent;
|
||||
}
|
||||
return INT2FIX(hash);
|
||||
return ST2FIX(hash);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -6444,7 +6444,7 @@ d_lite_hash(VALUE self)
|
|||
h[2] = m_df(dat);
|
||||
h[3] = m_sf(dat);
|
||||
v = rb_memhash(h, sizeof(h));
|
||||
return LONG2FIX(v);
|
||||
return ST2FIX(v);
|
||||
}
|
||||
|
||||
#include "date_tmx.h"
|
||||
|
|
|
@ -991,7 +991,7 @@ ossl_bn_hash(VALUE self)
|
|||
ossl_raise(eBNError, NULL);
|
||||
}
|
||||
|
||||
hash = INT2FIX(rb_memhash(buf, len));
|
||||
hash = ST2FIX(rb_memhash(buf, len));
|
||||
xfree(buf);
|
||||
|
||||
return hash;
|
||||
|
|
|
@ -1575,6 +1575,9 @@ rb_num2char_inline(VALUE x)
|
|||
#define NUM2CHR(x) RB_NUM2CHR(x)
|
||||
#define CHR2FIX(x) RB_CHR2FIX(x)
|
||||
|
||||
#define RB_ST2FIX(h) RB_LONG2FIX((long)(h))
|
||||
#define ST2FIX(h) RB_ST2FIX(h)
|
||||
|
||||
#define RB_ALLOC_N(type,n) ((type*)ruby_xmalloc2((size_t)(n),sizeof(type)))
|
||||
#define RB_ALLOC(type) ((type*)ruby_xmalloc(sizeof(type)))
|
||||
#define RB_ZALLOC_N(type,n) ((type*)ruby_xcalloc((size_t)(n),sizeof(type)))
|
||||
|
|
|
@ -372,8 +372,6 @@ ntz_intptr(uintptr_t x)
|
|||
VALUE rb_int128t2big(int128_t n);
|
||||
#endif
|
||||
|
||||
#define ST2FIX(h) LONG2FIX((long)(h))
|
||||
|
||||
static inline long
|
||||
rb_overflowed_fix_to_int(long x)
|
||||
{
|
||||
|
|
|
@ -549,6 +549,7 @@ class TestBigDecimal < Test::Unit::TestCase
|
|||
a.each_with_index do |x, i|
|
||||
assert_equal(i, h[x])
|
||||
end
|
||||
assert_instance_of(String, b.hash.to_s)
|
||||
end
|
||||
|
||||
def test_marshal
|
||||
|
|
|
@ -129,6 +129,8 @@ class TestDate < Test::Unit::TestCase
|
|||
assert_equal(3, h.size)
|
||||
assert_equal(9, h[Date.new(1999,5,25)])
|
||||
assert_equal(9, h[DateTime.new(1999,5,25)])
|
||||
|
||||
assert_instance_of(String, Date.new(1999,5,25).hash.to_s)
|
||||
end
|
||||
|
||||
def test_freeze
|
||||
|
|
|
@ -270,6 +270,7 @@ class OpenSSL::TestBN < OpenSSL::TestCase
|
|||
assert_equal(1, @e1.cmp(-999))
|
||||
assert_equal(0, @e1.ucmp(999))
|
||||
assert_equal(0, @e1.ucmp(-999))
|
||||
assert_instance_of(String, @e1.hash.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче