summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-10 10:55:08 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-10 10:55:08 +0000
commit6735633663cdb39c95075f0f92f34c6d8f5c4ec6 (patch)
tree85e8bbf232d63b58f1ff673524dc36e2da38c91f /bignum.c
parent0e8caa7d0f79c9514b4b4dbe9ac88b08e822e387 (diff)
Update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bignum.c b/bignum.c
index 9e02361d91..4ac0d0675e 100644
--- a/bignum.c
+++ b/bignum.c
@@ -843,6 +843,9 @@ integer_pack_take_lowbits(int n, BDIGIT_DBL *ddp, int *numbits_in_dd_p)
/*
* Export an integer into a buffer.
*
+ * This function fills the buffer specified by _words_ and _numwords_ as
+ * abs(val) in the format specified by _wordsize_, _nails_ and _flags_.
+ *
* [val] Fixnum, Bignum or another integer like object which has to_int method.
* [words] buffer to export abs(val).
* [numwords] the size of given buffer as number of words.
@@ -853,11 +856,13 @@ integer_pack_take_lowbits(int n, BDIGIT_DBL *ddp, int *numbits_in_dd_p)
* It specifies word order and byte order.
*
* This function returns the signedness and overflow condition as follows:
- * -2 : negative overflow.
- * -1 : negative without overflow.
- * 0 : zero.
- * 1 : positive without overflow.
- * 2 : positive overflow.
+ * -2 : negative overflow. val <= -2**(numwords*(wordsize*CHAR_BIT-nails))
+ * -1 : negative without overflow. -2**(numwords*(wordsize*CHAR_BIT-nails)) < val < 0
+ * 0 : zero. val == 0
+ * 1 : positive without overflow. 0 < val < 2**(numwords*(wordsize*CHAR_BIT-nails))
+ * 2 : positive overflow. 2**(numwords*(wordsize*CHAR_BIT-nails)) <= val
+ *
+ * The least significant words of abs(val) are filled in the buffer when overflow occur.
*/
int