summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-11 21:39:55 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-11 21:39:55 +0000
commit0c9a719d7728e026e2bd4dfef61d940d3ca7248f (patch)
treeabf593edd8848f8f9e18699b07a11aacb2389da8 /random.c
parenta338c4ed5d519f05bf1f9fcd6a7b237a3101df0a (diff)
downloadruby-0c9a719d7728e026e2bd4dfef61d940d3ca7248f.tar.gz
* internal.h (INTEGER_PACK_NEGATIVE): Defined.
(rb_integer_unpack): sign argument removed. * bignum.c (rb_integer_unpack): sign argument removed. Non-negative integers generated by default. INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers. * pack.c (pack_unpack): Follow the above change. * random.c (int_pair_to_real_inclusive): Ditto. (make_seed_value): Ditto. (mt_state): Ditto. (limited_big_rand): Ditto. * marshal.c (r_object0): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/random.c b/random.c
index 33fd1e94ed..4175e94b44 100644
--- a/random.c
+++ b/random.c
@@ -274,14 +274,14 @@ int_pair_to_real_inclusive(uint32_t a, uint32_t b)
/* (a << 32) | b */
xary[0] = a;
xary[1] = b;
- x = rb_integer_unpack(+1, xary, 2, sizeof(uint32_t), 0,
+ x = rb_integer_unpack(xary, 2, sizeof(uint32_t), 0,
INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER|
INTEGER_PACK_FORCE_BIGNUM);
/* (1 << 53) | 1 */
mary[0] = 0x00200000;
mary[1] = 0x00000001;
- m = rb_integer_unpack(+1, mary, 2, sizeof(uint32_t), 0,
+ m = rb_integer_unpack(mary, 2, sizeof(uint32_t), 0,
INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER|
INTEGER_PACK_FORCE_BIGNUM);
@@ -508,7 +508,7 @@ make_seed_value(const uint32_t *ptr)
len = DEFAULT_SEED_CNT;
}
- seed = rb_integer_unpack(+1, ptr, len, sizeof(uint32_t), 0,
+ seed = rb_integer_unpack(ptr, len, sizeof(uint32_t), 0,
INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
return seed;
@@ -571,7 +571,7 @@ random_copy(VALUE obj, VALUE orig)
static VALUE
mt_state(const struct MT *mt)
{
- return rb_integer_unpack(1, mt->state, numberof(mt->state),
+ return rb_integer_unpack(mt->state, numberof(mt->state),
sizeof(*mt->state), 0,
INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
}
@@ -778,7 +778,7 @@ limited_big_rand(struct MT *mt, VALUE limit)
}
rnd_array[i] = rnd;
}
- val = rb_integer_unpack(+1, rnd_array, len, sizeof(uint32_t), 0,
+ val = rb_integer_unpack(rnd_array, len, sizeof(uint32_t), 0,
INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
ALLOCV_END(vtmp);