summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-11 14:40:16 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-11 14:40:16 +0000
commitb23d9a8a637e5e63a93ea6a620b3dab3450f15e2 (patch)
tree0c644db703bcc461e7b3adce7500be52f06877db /bignum.c
parentc4b12333f770039fa4f189b3ac9ca015707836c3 (diff)
* bignum.c (validate_integer_pack_format): Don't require a word order
flag if numwords is 1 or less. (absint_numwords_generic): Don't specify a word order for rb_integer_pack. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index 3eb086c66e..0315cd5fc5 100644
--- a/bignum.c
+++ b/bignum.c
@@ -611,7 +611,7 @@ absint_numwords_generic(size_t numbytes, int nlz_bits_in_msbyte, size_t word_num
nlz_bits = word_numbits - NUM2SIZET(mod);
}
sign = rb_integer_pack(div, &numwords, 1, sizeof(numwords), 0,
- INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
if (sign == 2)
return (size_t)-1;
*nlz_bits_ret = nlz_bits;
@@ -740,7 +740,8 @@ validate_integer_pack_format(size_t numwords, size_t wordsize, size_t nails, int
int wordorder_bits = flags & INTEGER_PACK_WORDORDER_MASK;
int byteorder_bits = flags & INTEGER_PACK_BYTEORDER_MASK;
if (wordorder_bits == 0) {
- rb_raise(rb_eArgError, "word order not specified");
+ if (1 < numwords)
+ rb_raise(rb_eArgError, "word order not specified");
}
else if (wordorder_bits != INTEGER_PACK_MSWORD_FIRST &&
wordorder_bits != INTEGER_PACK_LSWORD_FIRST)