From e47c7f6d3cb5cc27ce0108d868ca4dae2ac5c449 Mon Sep 17 00:00:00 2001 From: Hrik Bhowal Date: Thu, 23 May 2024 16:59:51 -0400 Subject: [PATCH] fix: fix leading zero counter --- src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e6e6ed8..a40f5fd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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),);