ruby-changes:14973
From: akr <ko1@a...>
Date: Sun, 7 Mar 2010 23:15:46 +0900 (JST)
Subject: [ruby-changes:14973] Ruby:r26845 (trunk): * bignum.c (rb_big_pack): use DIGSPERLONG and BITSPERDIG.
akr 2010-03-07 23:15:24 +0900 (Sun, 07 Mar 2010) New Revision: 26845 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26845 Log: * bignum.c (rb_big_pack): use DIGSPERLONG and BITSPERDIG. (rb_big_unpack): use DIGSPERLONG. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 26844) +++ ChangeLog (revision 26845) @@ -1,3 +1,8 @@ +Sun Mar 7 23:14:22 2010 Tanaka Akira <akr@f...> + + * bignum.c (rb_big_pack): use DIGSPERLONG and BITSPERDIG. + (rb_big_unpack): use DIGSPERLONG. + Sun Mar 7 19:21:10 2010 Marc-Andre Lafortune <ruby-core@m...> * io.c: Fix documentation for each/each_line/lines, bytes/each_byte, Index: bignum.c =================================================================== --- bignum.c (revision 26844) +++ bignum.c (revision 26845) @@ -342,8 +342,8 @@ long i, j; for (i = 0; i < num_longs && ds < dend; i++) { unsigned long l = 0; - for (j = 0; j < SIZEOF_LONG/SIZEOF_BDIGITS && ds < dend; j++, ds++) { - l |= ((unsigned long)*ds << (j * SIZEOF_BDIGITS * CHAR_BIT)); + for (j = 0; j < DIGSPERLONG && ds < dend; j++, ds++) { + l |= ((unsigned long)*ds << (j * BITSPERDIG)); } buf[i] = l; } @@ -381,7 +381,7 @@ else { VALUE big; BDIGIT *ds; - long len = num_longs * (SIZEOF_LONG/SIZEOF_BDIGITS); + long len = num_longs * DIGSPERLONG; long i; big = bignew(len, 1); ds = BDIGITS(big); @@ -391,7 +391,7 @@ *ds++ = d; #else int j; - for (j = 0; j < SIZEOF_LONG/SIZEOF_BDIGITS; j++) { + for (j = 0; j < DIGSPERLONG; j++) { *ds++ = BIGLO(d); d = BIGDN(d); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/