Skip to content

Commit

Permalink
Merge pull request #22 from mbroz/master
Browse files Browse the repository at this point in the history
Do not report file input rewind if nothing was read repeatedly.
  • Loading branch information
eddelbuettel authored Feb 23, 2024
2 parents c987a15 + 67989b4 commit 2d4763a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libdieharder/rng_file_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ static void file_input_set (void *vstate, unsigned long int s);
uint file_input_get_rewind_cnt(gsl_rng *rng)
{
file_input_state_t *state = (file_input_state_t *) rng->state;

/*
* End of file was reached, but nothing was read yet (repeatedly).
* Do not report file rewind yet.
*/
if (state->rewind_cnt > 0 && state->rptr == 0)
return state->rewind_cnt - 1;

return state->rewind_cnt;
}

Expand Down

0 comments on commit 2d4763a

Please sign in to comment.