Skip to content

Commit

Permalink
Simplify some code, sacrifice a few promiles of speed
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteube committed Jan 16, 2015
1 parent dd9e621 commit 60008ad
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/pp.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ static void chain_set_pwbuf_increment (const chain_t *chain_buf, const db_entry_

const u64 elems_cnt = db_entry->elems_cnt;

const u64 elems_idx = ++cur_chain_ks_poses[idx];
cur_chain_ks_poses[idx]++;

const u64 elems_idx = cur_chain_ks_poses[idx];

if (elems_idx < elems_cnt)
{
Expand Down Expand Up @@ -1064,15 +1066,13 @@ int main (int argc, char *argv[])
set_chain_ks_poses (chain_buf, db_entries, tmp, db_entry->cur_chain_ks_poses);
}

u64 *cur_chain_ks_poses = db_entry->cur_chain_ks_poses;

chain_set_pwbuf_init (chain_buf, db_entries, cur_chain_ks_poses, pw_buf);
chain_set_pwbuf_init (chain_buf, db_entries, db_entry->cur_chain_ks_poses, pw_buf);

while (iter_pos_u64 < iter_max_u64)
{
out_push (out, pw_buf, pw_len + 1);

chain_set_pwbuf_increment (chain_buf, db_entries, cur_chain_ks_poses, pw_buf);
chain_set_pwbuf_increment (chain_buf, db_entries, db_entry->cur_chain_ks_poses, pw_buf);

iter_pos_u64++;
}
Expand All @@ -1094,8 +1094,6 @@ int main (int argc, char *argv[])
{
db_entry->chains_pos++;

// db_entry->cur_chain_ks_poses[] should of cycled to all zeros, but just in case?

memset (db_entry->cur_chain_ks_poses, 0, ELEM_CNT_MAX * sizeof (u64));
}

Expand Down

0 comments on commit 60008ad

Please sign in to comment.