Skip to content

MAINT: random: Fix a few compiler warnings. #13786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions numpy/random/src/distributions/distributions.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,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 (;;) {
Expand All @@ -178,7 +178,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;
Expand Down Expand Up @@ -215,15 +215,15 @@ 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 (;;) {
/* r = n23sb8 */
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;
Expand Down
3 changes: 2 additions & 1 deletion numpy/random/src/xoshiro256/xoshiro256.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion numpy/random/src/xoshiro512/xoshiro512.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down