Skip to content
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

Do not report file input rewind if nothing was read repeatedly. #22

Merged
merged 1 commit into from
Feb 23, 2024
Merged
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: 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
Loading