summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-04 14:20:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-04 14:20:49 +0000
commitef7d0431a0c59839f555123ccd5ad06418209c0c (patch)
tree85741b20691fa10afe310aac8e5ab7dbb5e08fab /bignum.c
parent6bec06674c2a51af865a5d8d7c31d93799f98d59 (diff)
add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index d316a60d82..0074ba77dc 100644
--- a/bignum.c
+++ b/bignum.c
@@ -308,6 +308,19 @@ rb_int2inum(SIGNED_VALUE n)
# error unexpected SIZEOF_LONG : SIZEOF_BDIGITS ratio
#endif
+/*
+ * buf is an array of long integers.
+ * buf is ordered from least significant word to most significant word.
+ * buf[0] is the least significant word and
+ * buf[num_longs-1] is the most significant word.
+ * This means words in buf is little endian.
+ * However each word in buf is native endian.
+ * (buf[i]&1) is the least significant bit and
+ * (buf[i]&(1<<(SIZEOF_LONG*CHAR_BIT-1))) is the most significant bit
+ * 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.
+ */
void
rb_big_pack(VALUE val, unsigned long *buf, long num_longs)
{
@@ -349,6 +362,7 @@ rb_big_pack(VALUE val, unsigned long *buf, long num_longs)
}
}
+/* See rb_big_pack comment for endianness of buf. */
VALUE
rb_big_unpack(unsigned long *buf, long num_longs)
{