From e1ce20cf9b179d6973992f0871037e570cdf0e02 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 5 May 2016 15:00:05 +0000 Subject: random.c: use uint32_t * random.c (struct MT, next_state): use uint32_t for the state vector. * random.c (init_by_array, rand_init): ditto for initializing keys. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- random.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/random.c b/random.c index 31e7db22f4..c6fb9e0574 100644 --- a/random.c +++ b/random.c @@ -104,8 +104,8 @@ enum {MT_MAX_STATE = N}; struct MT { /* assume int is enough to store 32bits */ - unsigned int state[N]; /* the array for the state vector */ - unsigned int *next; + uint32_t state[N]; /* the array for the state vector */ + uint32_t *next; int left; }; @@ -135,7 +135,7 @@ init_genrand(struct MT *mt, unsigned int s) /* key_length is its length */ /* slight change for C++, 2004/2/26 */ static void -init_by_array(struct MT *mt, unsigned int init_key[], int key_length) +init_by_array(struct MT *mt, uint32_t init_key[], int key_length) { int i, j, k; init_genrand(mt, 19650218U); @@ -163,7 +163,7 @@ init_by_array(struct MT *mt, unsigned int init_key[], int key_length) static void next_state(struct MT *mt) { - unsigned int *p = mt->state; + uint32_t *p = mt->state; int j; mt->left = N; @@ -391,7 +391,7 @@ rand_init(struct MT *mt, VALUE vseed) len = rb_absint_numwords(seed, 32, NULL); if (len > numberof(buf0)) - buf = ALLOC_N(unsigned int, len); + buf = ALLOC_N(uint32_t, len); sign = rb_integer_pack(seed, buf, len, sizeof(uint32_t), 0, INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER); if (sign < 0) -- cgit v1.2.3