Skip to content

Commit

Permalink
Fixed major bug where all candidates are of the same length till chai…
Browse files Browse the repository at this point in the history
…n changes
  • Loading branch information
jsteube committed Jan 13, 2015
1 parent 231e2ef commit 6f4269e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* v0.17 -> v0.18:

- Fixed major bug where all candidates are of the same length till chain changes

* v0.16 -> v0.17:

- Fixed download url for binaries in README
Expand Down
17 changes: 15 additions & 2 deletions src/pp.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,11 @@ int main (int argc, char *argv[])

db_entry_t *db_entry = &db_entries[pw_len];

const u64 elems_cnt = wordlen_dist[pw_len];
const u64 outs_cnt = wordlen_dist[pw_len];

for (u64 elems_pos = 0; elems_pos < elems_cnt; elems_pos++)
u64 outs_pos = 0;

while (outs_pos < outs_cnt)
{
const int chains_cnt = db_entry->chains_cnt;
const int chains_pos = db_entry->chains_pos;
Expand All @@ -859,6 +861,15 @@ int main (int argc, char *argv[])
mpz_set (iter_max, total_ks_left);
}

const u64 outs_left = outs_cnt - outs_pos;

mpz_set_ui (tmp, outs_left);

if (mpz_cmp (tmp, iter_max) < 0)
{
mpz_set (iter_max, tmp);
}

const u64 iter_max_u64 = mpz_get_ui (iter_max);

mpz_add (tmp, total_ks_pos, iter_max);
Expand Down Expand Up @@ -886,6 +897,8 @@ int main (int argc, char *argv[])
}
}

outs_pos += iter_max_u64;

mpz_add (total_ks_pos, total_ks_pos, iter_max);

mpz_add (chain_buf->ks_pos, chain_buf->ks_pos, iter_max);
Expand Down

0 comments on commit 6f4269e

Please sign in to comment.