* bignum.c (calc_hbase): Make hbase the maximum power of base
representable in BDIGIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2a38d9043e
commit
25e5a75863
@ -1,3 +1,8 @@
|
|||||||
|
Sat Jun 1 00:19:50 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* bignum.c (calc_hbase): Make hbase the maximum power of base
|
||||||
|
representable in BDIGIT.
|
||||||
|
|
||||||
Fri May 31 23:56:13 2013 Tanaka Akira <akr@fsij.org>
|
Fri May 31 23:56:13 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* bignum.c (calc_hbase): Extracted from rb_big2str0.
|
* bignum.c (calc_hbase): Extracted from rb_big2str0.
|
||||||
|
12
bignum.c
12
bignum.c
@ -1125,12 +1125,12 @@ calc_hbase(int base, long *hbase_p, int *hbase_numdigits_p)
|
|||||||
long hbase;
|
long hbase;
|
||||||
int hbase_numdigits;
|
int hbase_numdigits;
|
||||||
|
|
||||||
hbase = base*base;
|
hbase = base;
|
||||||
hbase_numdigits = 2;
|
hbase_numdigits = 1;
|
||||||
#if SIZEOF_BDIGITS > 2
|
while (hbase <= (~(BDIGIT)0) / base) {
|
||||||
hbase *= hbase;
|
hbase *= base;
|
||||||
hbase_numdigits *= 2;
|
hbase_numdigits++;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
*hbase_p = hbase;
|
*hbase_p = hbase;
|
||||||
*hbase_numdigits_p = hbase_numdigits;
|
*hbase_numdigits_p = hbase_numdigits;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user