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

* bignum.oc (rb_absint_size): Declare a variable, i, just before used

to suppress a warning.
  (rb_int_export): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-07 09:25:47 +00:00
parent f8cf43706a
commit e54d70882c
2 changed files with 19 additions and 8 deletions

View file

@ -1,3 +1,9 @@
Fri Jun 7 18:24:39 2013 Tanaka Akira <akr@fsij.org>
* bignum.oc (rb_absint_size): Declare a variable, i, just before used
to suppress a warning.
(rb_int_export): Ditto.
Fri Jun 7 17:41:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit

View file

@ -458,7 +458,7 @@ rb_absint_size(VALUE val, int *number_of_leading_zero_bits)
BDIGIT *dp;
BDIGIT *de;
BDIGIT fixbuf[(sizeof(long) + SIZEOF_BDIGITS - 1) / SIZEOF_BDIGITS];
int i;
int num_leading_zeros;
val = rb_to_int(val);
@ -471,9 +471,12 @@ rb_absint_size(VALUE val, int *number_of_leading_zero_bits)
#if SIZEOF_BDIGITS == SIZEOF_LONG
fixbuf[0] = v;
#else
for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
v >>= SIZEOF_BDIGITS * CHAR_BIT;
{
int i;
for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
v >>= SIZEOF_BDIGITS * CHAR_BIT;
}
}
#endif
dp = fixbuf;
@ -584,7 +587,6 @@ rb_int_export(VALUE val, int *signp, size_t *wordcount_allocated, void *words, s
BDIGIT *dp;
BDIGIT *de;
BDIGIT fixbuf[(sizeof(long) + SIZEOF_BDIGITS - 1) / SIZEOF_BDIGITS];
int i;
unsigned char *buf, *bufend;
val = rb_to_int(val);
@ -622,9 +624,12 @@ rb_int_export(VALUE val, int *signp, size_t *wordcount_allocated, void *words, s
#if SIZEOF_BDIGITS == SIZEOF_LONG
fixbuf[0] = v;
#else
for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
v >>= SIZEOF_BDIGITS * CHAR_BIT;
{
int i;
for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
v >>= SIZEOF_BDIGITS * CHAR_BIT;
}
}
#endif
dp = fixbuf;