From 50070e69636b15f7dd845a4d30849242130e6864 Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Fri, 28 Feb 2025 23:04:38 +0100 Subject: [PATCH] Readability refactoring --- src/rand/xoshiro256.c | 8 ++++---- src/rand/xoshiro256.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rand/xoshiro256.c b/src/rand/xoshiro256.c index 8c720e7..a2ab65d 100644 --- a/src/rand/xoshiro256.c +++ b/src/rand/xoshiro256.c @@ -25,7 +25,7 @@ uint64_t rotate_uint64_left(uint64_t bytes, int degree) } -uint64_t xoshiro256_next(xoshiro256_state_t* state) { +uint64_t xoshiro256_next(Xoshiro256State* state) { uint64_t* uint64_state = state->state; const uint64_t result = rotate_uint64_left(uint64_state[0] + uint64_state[3], 23) + uint64_state[0]; @@ -48,7 +48,7 @@ uint64_t xoshiro256_next(xoshiro256_state_t* state) { to 2^128 calls to next(); it can be used to generate 2^128 non-overlapping subsequences for parallel computations. */ -void jump(xoshiro256_state_t* state) { +void jump(Xoshiro256State* state) { uint64_t* uint64_state = state->state; static const uint64_t JUMP[] = { 0x180ec6d33cfd0aba, 0xd5a61266f0c9392c, 0xa9582618e03fc9aa, 0x39abdc4529b1661c }; @@ -80,7 +80,7 @@ void jump(xoshiro256_state_t* state) { from each of which jump() will generate 2^64 non-overlapping subsequences for parallel distributed computations. */ -void long_jump(xoshiro256_state_t* state) { +void long_jump(Xoshiro256State* state) { uint64_t* uint64_state = state->state; static const uint64_t LONG_JUMP[] = { 0x76e15d3efefdcbbf, 0xc5004e441c522fb3, 0x77710069854ee241, 0x39109bb02acbe635 }; @@ -103,4 +103,4 @@ void long_jump(xoshiro256_state_t* state) { uint64_state[1] = s1; uint64_state[2] = s2; uint64_state[3] = s3; -} \ No newline at end of file +} diff --git a/src/rand/xoshiro256.h b/src/rand/xoshiro256.h index d88f3a0..9403576 100644 --- a/src/rand/xoshiro256.h +++ b/src/rand/xoshiro256.h @@ -22,12 +22,12 @@ #include -typedef struct XoshiroState { +typedef struct XoshiroState_s { uint64_t state[4]; -} xoshiro256_state_t; +} Xoshiro256State; uint64_t rotate_uint64_left(uint64_t bytes, int degree); -uint64_t xoshiro256_next(xoshiro256_state_t *state); +uint64_t xoshiro256_next(Xoshiro256State *state); -#endif \ No newline at end of file +#endif