1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* util.c (ruby_hdtoa): fix type cast and bufsize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-11-08 09:28:42 +00:00
parent 599a7071c1
commit e640e1c565
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Mon Nov 8 18:26:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
* util.c (ruby_hdtoa): fix type cast and bufsize.
Mon Nov 8 15:40:56 2010 NARUSE, Yui <naruse@ruby-lang.org>
* vsnprintf.c (BSD_vfprintf): fix precision specifier doesn't

6
util.c
View file

@ -3934,8 +3934,8 @@ ruby_each_words(const char *str, void (*func)(const char*, int, void*), void *ar
#define SIGFIGS ((DBL_MANT_DIG + 3) / 4 + 1)
#define dexp_get(u) ((int)(word0(u) >> Exp_shift) & ~Exp_msk1)
#define dexp_set(u,v) (word0(u) = (((int)(word0(u)) & ~Exp_mask) | (v << Exp_shift)))
#define dmanh_get(u) ((int)(word0(u) & Frac_mask))
#define dmanl_get(u) ((int)word1(u))
#define dmanh_get(u) ((uint32_t)(word0(u) & Frac_mask))
#define dmanl_get(u) ((uint32_t)word1(u))
/*
@ -4008,7 +4008,7 @@ ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
* enough space for all the digits.
*/
bufsize = (ndigits > 0) ? ndigits : SIGFIGS;
s0 = rv_alloc(bufsize);
s0 = rv_alloc(bufsize+1);
/* Round to the desired number of digits. */
if (SIGFIGS > ndigits && ndigits > 0) {