Skip to content

Commit 6f4269e

Browse files
committed
Fixed major bug where all candidates are of the same length till chain changes
1 parent 231e2ef commit 6f4269e

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* v0.17 -> v0.18:
2+
3+
- Fixed major bug where all candidates are of the same length till chain changes
4+
15
* v0.16 -> v0.17:
26

37
- Fixed download url for binaries in README

src/pp.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,9 +837,11 @@ int main (int argc, char *argv[])
837837

838838
db_entry_t *db_entry = &db_entries[pw_len];
839839

840-
const u64 elems_cnt = wordlen_dist[pw_len];
840+
const u64 outs_cnt = wordlen_dist[pw_len];
841841

842-
for (u64 elems_pos = 0; elems_pos < elems_cnt; elems_pos++)
842+
u64 outs_pos = 0;
843+
844+
while (outs_pos < outs_cnt)
843845
{
844846
const int chains_cnt = db_entry->chains_cnt;
845847
const int chains_pos = db_entry->chains_pos;
@@ -859,6 +861,15 @@ int main (int argc, char *argv[])
859861
mpz_set (iter_max, total_ks_left);
860862
}
861863

864+
const u64 outs_left = outs_cnt - outs_pos;
865+
866+
mpz_set_ui (tmp, outs_left);
867+
868+
if (mpz_cmp (tmp, iter_max) < 0)
869+
{
870+
mpz_set (iter_max, tmp);
871+
}
872+
862873
const u64 iter_max_u64 = mpz_get_ui (iter_max);
863874

864875
mpz_add (tmp, total_ks_pos, iter_max);
@@ -886,6 +897,8 @@ int main (int argc, char *argv[])
886897
}
887898
}
888899

900+
outs_pos += iter_max_u64;
901+
889902
mpz_add (total_ks_pos, total_ks_pos, iter_max);
890903

891904
mpz_add (chain_buf->ks_pos, chain_buf->ks_pos, iter_max);

0 commit comments

Comments
 (0)