From 566fde76996e2c694b1f8c96605645e16dfc350a Mon Sep 17 00:00:00 2001 From: AndersTrier Date: Mon, 12 Aug 2024 15:38:17 +0200 Subject: [PATCH] formal_derivative: Simply expression for `width` using `trailing_zeros()` instead --- src/engine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine.rs b/src/engine.rs index 45e4179..94d76f5 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -228,7 +228,7 @@ pub trait Engine { Self: Sized, { for i in 1..data.len() { - let width: usize = ((i ^ (i - 1)) + 1) >> 1; + let width: usize = 1 << i.trailing_zeros(); Self::xor_within(data, i - width, i, width); } }