* ext/bigdecimal/bigdecimal.c (VpAddAbs): put out a conditional branch from
the inside of while-loop. * ext/bigdecimal/bigdecimal.c (VpSubAbs): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27d53fb5df
commit
7d3538db3f
@ -1,3 +1,10 @@
|
|||||||
|
Wed Dec 13 01:56:00 2013 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
|
* ext/bigdecimal/bigdecimal.c (VpAddAbs): put out a conditional branch from
|
||||||
|
the inside of while-loop.
|
||||||
|
|
||||||
|
* ext/bigdecimal/bigdecimal.c (VpSubAbs): ditto.
|
||||||
|
|
||||||
Wed Dec 13 01:53:00 2013 Kenta Murata <mrkn@mrkn.jp>
|
Wed Dec 13 01:53:00 2013 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (VPrint): be a static function, support another
|
* ext/bigdecimal/bigdecimal.c (VPrint): be a static function, support another
|
||||||
|
@ -4196,14 +4196,14 @@ VpAddAbs(Real *a, Real *b, Real *c)
|
|||||||
|
|
||||||
/* Just assign the last few digits of b to c because a has no */
|
/* Just assign the last few digits of b to c because a has no */
|
||||||
/* corresponding digits to be added. */
|
/* corresponding digits to be added. */
|
||||||
while (b_pos + word_shift > a_pos) {
|
|
||||||
--c_pos;
|
|
||||||
if (b_pos > 0) {
|
if (b_pos > 0) {
|
||||||
c->frac[c_pos] = b->frac[--b_pos];
|
while (b_pos > 0 && b_pos + word_shift > a_pos) {
|
||||||
|
c->frac[--c_pos] = b->frac[--b_pos];
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
--word_shift;
|
if (b_pos == 0 && word_shift > a_pos) {
|
||||||
c->frac[c_pos] = 0;
|
while (word_shift-- > a_pos) {
|
||||||
|
c->frac[--c_pos] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4299,17 +4299,17 @@ VpSubAbs(Real *a, Real *b, Real *c)
|
|||||||
/* each of the last few digits of the b because the a has no */
|
/* each of the last few digits of the b because the a has no */
|
||||||
/* corresponding digits to be subtracted. */
|
/* corresponding digits to be subtracted. */
|
||||||
if (b_pos + word_shift > a_pos) {
|
if (b_pos + word_shift > a_pos) {
|
||||||
while (b_pos + word_shift > a_pos) {
|
while (b_pos > 0 && b_pos + word_shift > a_pos) {
|
||||||
--c_pos;
|
c->frac[--c_pos] = BASE - b->frac[--b_pos] - borrow;
|
||||||
if (b_pos > 0) {
|
|
||||||
c->frac[c_pos] = BASE - b->frac[--b_pos] - borrow;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
--word_shift;
|
|
||||||
c->frac[c_pos] = BASE - borrow;
|
|
||||||
}
|
|
||||||
borrow = 1;
|
borrow = 1;
|
||||||
}
|
}
|
||||||
|
if (b_pos == 0) {
|
||||||
|
while (word_shift > a_pos) {
|
||||||
|
--word_shift;
|
||||||
|
c->frac[--c_pos] = BASE - borrow;
|
||||||
|
borrow = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Just assign the last few digits of a to c because b has no */
|
/* Just assign the last few digits of a to c because b has no */
|
||||||
/* corresponding digits to subtract. */
|
/* corresponding digits to subtract. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user