ruby-changes:22713
From: akr <ko1@a...>
Date: Thu, 23 Feb 2012 19:53:01 +0900 (JST)
Subject: [ruby-changes:22713] akr:r34762 (trunk): update comment.
akr 2012-02-23 19:52:51 +0900 (Thu, 23 Feb 2012) New Revision: 34762 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34762 Log: update comment. Modified files: trunk/bignum.c Index: bignum.c =================================================================== --- bignum.c (revision 34761) +++ bignum.c (revision 34762) @@ -349,6 +349,14 @@ * for each 0 <= i < num_longs. * So buf is little endian at whole on a little endian machine. * But buf is mixed endian on a big endian machine. + * + * The buf represents negative integers as two's complement. + * So, the most significant bit of the most significant word, + * (buf[num_longs-1]>>(SIZEOF_LONG*CHAR_BIT-1)), + * is the sign bit: 1 means negative and 0 means zero or positive. + * + * If given size of buf (num_longs) is not enough to represent val, + * higier words (including a sign bit) are ignored. */ void rb_big_pack(VALUE val, unsigned long *buf, long num_longs) @@ -391,7 +399,7 @@ } } -/* See rb_big_pack comment for endianness of buf. */ +/* See rb_big_pack comment for endianness and sign of buf. */ VALUE rb_big_unpack(unsigned long *buf, long num_longs) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/