Skip to content

Commit

Permalink
fix: fix leading zero counter
Browse files Browse the repository at this point in the history
  • Loading branch information
HrikB committed May 23, 2024
1 parent d979499 commit e47c7f6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,14 @@ pub fn gpu(config: Config) -> ocl::Result<()> {
let mut total = 0;
let mut leading = 0;
for (i, &b) in address.iter().enumerate() {
if b == 0 {
total += 1;
} else if leading == 0 {
// set leading on finding non-zero byte
leading = i;
#[rustfmt::skip]
if b != 0 { continue; };

if leading == i {
leading = i + 1;
}

total += 1;
}

let output = format!("0x{} => 0x{}", hex::encode(salt), hex::encode(address),);
Expand Down

0 comments on commit e47c7f6

Please sign in to comment.