mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big2str0, bigsqr): made interruptible. [ruby-Bugs-20622]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b04f0093a
commit
e2ec68e53a
3 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Jul 25 18:04:17 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (rb_big2str0, bigsqr): made interruptible. [ruby-Bugs-20622]
|
||||
|
||||
Fri Jul 25 00:10:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (rb_find_file_ext, rb_find_file): converts Windows style path
|
||||
|
|
5
bignum.c
5
bignum.c
|
@ -11,6 +11,7 @@
|
|||
**********************************************************************/
|
||||
|
||||
#include "ruby.h"
|
||||
#include "rubysig.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
@ -720,6 +721,7 @@ rb_big2str0(x, base, trim)
|
|||
s = RSTRING(ss)->ptr;
|
||||
|
||||
s[0] = RBIGNUM(x)->sign ? '+' : '-';
|
||||
TRAP_BEG;
|
||||
while (i && j > 1) {
|
||||
long k = i;
|
||||
BDIGIT_DBL num = 0;
|
||||
|
@ -749,6 +751,7 @@ rb_big2str0(x, base, trim)
|
|||
RSTRING(ss)->len = i;
|
||||
}
|
||||
s[RSTRING(ss)->len] = '\0';
|
||||
TRAP_END;
|
||||
|
||||
return ss;
|
||||
}
|
||||
|
@ -1735,11 +1738,13 @@ bigsqr(x)
|
|||
RBIGNUM(z)->len = len;
|
||||
a2 = bigtrunc(rb_big_mul0(a, b));
|
||||
len = RBIGNUM(a2)->len;
|
||||
TRAP_BEG;
|
||||
for (i = 0, num = 0; i < len; i++) {
|
||||
num += (BDIGIT_DBL)BDIGITS(z)[i + k] + ((BDIGIT_DBL)BDIGITS(a2)[i] << 1);
|
||||
BDIGITS(z)[i + k] = BIGLO(num);
|
||||
num = BIGDN(num);
|
||||
}
|
||||
TRAP_END;
|
||||
if (num) {
|
||||
len = RBIGNUM(z)->len;
|
||||
for (i += k; i < len && num; ++i) {
|
||||
|
|
|
@ -368,7 +368,8 @@ RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \
|
|||
|
||||
array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) \
|
||||
{$(VPATH)}util.h {$(VPATH)}st.h
|
||||
bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES)
|
||||
bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES) \
|
||||
{$(VPATH)}rubysig.h
|
||||
class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) \
|
||||
{$(VPATH)}rubysig.h {$(VPATH)}node.h {$(VPATH)}st.h
|
||||
compar.$(OBJEXT): {$(VPATH)}compar.c $(RUBY_H_INCLUDES)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue