mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-24 17:01:21 -04:00
use smaller integers for random cache state
This commit is contained in:
parent
1fed72a9c3
commit
943a81fbeb
2 changed files with 6 additions and 6 deletions
4
random.c
4
random.c
|
@ -56,7 +56,7 @@ static void refill(struct random_state *state) {
|
|||
|
||||
u16 get_random_u16(struct random_state *state) {
|
||||
u16 value;
|
||||
size_t remaining = RANDOM_CACHE_SIZE - state->index;
|
||||
unsigned remaining = RANDOM_CACHE_SIZE - state->index;
|
||||
if (remaining < sizeof(value)) {
|
||||
refill(state);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ u16 get_random_u16_uniform(struct random_state *state, u16 bound) {
|
|||
|
||||
u64 get_random_u64(struct random_state *state) {
|
||||
u64 value;
|
||||
size_t remaining = RANDOM_CACHE_SIZE - state->index;
|
||||
unsigned remaining = RANDOM_CACHE_SIZE - state->index;
|
||||
if (remaining < sizeof(value)) {
|
||||
refill(state);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue