зеркало из https://github.com/github/ruby.git
* include/ruby/ruby.h (rb_float_value): optimize it.
This technique was pointed by shinichiro.hamaji <http://shinh.skr.jp/m/?date=20120825#p02>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
10d85333ac
Коммит
0b89d6d5f9
|
@ -1,3 +1,9 @@
|
|||
Mon Aug 27 18:19:36 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* include/ruby/ruby.h (rb_float_value): optimize it.
|
||||
This technique was pointed by shinichiro.hamaji
|
||||
<http://shinh.skr.jp/m/?date=20120825#p02>.
|
||||
|
||||
Mon Aug 27 15:08:25 2012 Yuki Yugui Sonoda <yugui@google.com>
|
||||
|
||||
* common.mk (vm_trace.o): Added a missing dependency.
|
||||
|
|
|
@ -733,10 +733,7 @@ static inline double
|
|||
rb_float_value(VALUE v)
|
||||
{
|
||||
if (FLONUM_P(v)) {
|
||||
if (v == (VALUE)0x8000000000000002) {
|
||||
return 0.0;
|
||||
}
|
||||
else {
|
||||
if (v != (VALUE)0x8000000000000002) { /* LIKELY */
|
||||
union {
|
||||
double d;
|
||||
VALUE v;
|
||||
|
@ -746,9 +743,12 @@ rb_float_value(VALUE v)
|
|||
/* e: xx1... -> 011... */
|
||||
/* xx0... -> 100... */
|
||||
/* ^b63 */
|
||||
t.v = RUBY_BIT_ROTR(((b63 ^ 1) << 1) | b63 | (v & ~0x03), 3);
|
||||
t.v = RUBY_BIT_ROTR(2 - b63 | (v & ~0x03), 3);
|
||||
return t.d;
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return ((struct RFloat *)v)->float_value;
|
||||
|
|
Загрузка…
Ссылка в новой задаче