diff options
author | Matti Picus <matti.picus@gmail.com> | 2019-06-18 00:40:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-18 00:40:31 +0300 |
commit | 17e7ba7aa9ebec64162530bc4d4096e49d958409 (patch) | |
tree | ebcabc925773a15767f2dab0688a5822f34c2f6b /numpy/random/src | |
parent | 28d1bb023d86c07105cfeea604e30da0da326538 (diff) | |
parent | 5b34a0c729e2d93563d23f86c9ea0b0d3366ab9e (diff) | |
download | numpy-17e7ba7aa9ebec64162530bc4d4096e49d958409.tar.gz |
Merge pull request #13786 from WarrenWeckesser/random-warnings
MAINT: random: Fix a few compiler warnings.
Diffstat (limited to 'numpy/random/src')
-rw-r--r-- | numpy/random/src/distributions/distributions.c | 8 | ||||
-rw-r--r-- | numpy/random/src/xoshiro256/xoshiro256.c | 3 | ||||
-rw-r--r-- | numpy/random/src/xoshiro512/xoshiro512.c | 3 |
3 files changed, 8 insertions, 6 deletions
diff --git a/numpy/random/src/distributions/distributions.c b/numpy/random/src/distributions/distributions.c index c0550ad8e..65257ecbf 100644 --- a/numpy/random/src/distributions/distributions.c +++ b/numpy/random/src/distributions/distributions.c @@ -170,7 +170,7 @@ float random_standard_exponential_zig_f(bitgen_t *bitgen_state) { static NPY_INLINE double next_gauss_zig(bitgen_t *bitgen_state) { uint64_t r; int sign; - int64_t rabs; + uint64_t rabs; int idx; double x, xx, yy; for (;;) { @@ -179,7 +179,7 @@ static NPY_INLINE double next_gauss_zig(bitgen_t *bitgen_state) { idx = r & 0xff; r >>= 8; sign = r & 0x1; - rabs = (int64_t)((r >> 1) & 0x000fffffffffffff); + rabs = (r >> 1) & 0x000fffffffffffff; x = rabs * wi_double[idx]; if (sign & 0x1) x = -x; @@ -216,7 +216,7 @@ void random_gauss_zig_fill(bitgen_t *bitgen_state, npy_intp cnt, double *out) { float random_gauss_zig_f(bitgen_t *bitgen_state) { uint32_t r; int sign; - int32_t rabs; + uint32_t rabs; int idx; float x, xx, yy; for (;;) { @@ -224,7 +224,7 @@ float random_gauss_zig_f(bitgen_t *bitgen_state) { r = next_uint32(bitgen_state); idx = r & 0xff; sign = (r >> 8) & 0x1; - rabs = (int32_t)((r >> 9) & 0x0007fffff); + rabs = (r >> 9) & 0x0007fffff; x = rabs * wi_float[idx]; if (sign & 0x1) x = -x; diff --git a/numpy/random/src/xoshiro256/xoshiro256.c b/numpy/random/src/xoshiro256/xoshiro256.c index f5cda2721..a9ac49aa6 100644 --- a/numpy/random/src/xoshiro256/xoshiro256.c +++ b/numpy/random/src/xoshiro256/xoshiro256.c @@ -6,6 +6,7 @@ worldwide. This software is distributed without any warranty. See <http://creativecommons.org/publicdomain/zero/1.0/>. */ +#include <stddef.h> #include "xoshiro256.h" /* This is xoshiro256** 1.0, our all-purpose, rock-solid generator. It has @@ -29,7 +30,7 @@ extern NPY_INLINE uint32_t xoshiro256_next32(xoshiro256_state *state); void xoshiro256_jump(xoshiro256_state *state) { - int i, b; + size_t i, b; static const uint64_t JUMP[] = {0x180ec6d33cfd0aba, 0xd5a61266f0c9392c, 0xa9582618e03fc9aa, 0x39abdc4529b1661c}; uint64_t s0 = 0; diff --git a/numpy/random/src/xoshiro512/xoshiro512.c b/numpy/random/src/xoshiro512/xoshiro512.c index 9fdbed125..4f4af86f0 100644 --- a/numpy/random/src/xoshiro512/xoshiro512.c +++ b/numpy/random/src/xoshiro512/xoshiro512.c @@ -6,6 +6,7 @@ worldwide. This software is distributed without any warranty. See <http://creativecommons.org/publicdomain/zero/1.0/>. */ +#include <stddef.h> #include "xoshiro512.h" /* This is xoshiro512** 1.0, an all-purpose, rock-solid generator. It has @@ -32,7 +33,7 @@ static uint64_t s_placeholder[8]; void xoshiro512_jump(xoshiro512_state *state) { - int i, b, w; + size_t i, b, w; static const uint64_t JUMP[] = {0x33ed89b6e7a353f9, 0x760083d7955323be, 0x2837f2fbb5f22fae, 0x4b8c5674d309511c, 0xb11ac47a7ba28c25, 0xf1be7667092bcc1c, |