From ca759078eae448aea8060ef49e8d0b023b7d74dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Lindstr=C3=B8m?= Date: Thu, 22 Aug 2024 12:49:23 +0200 Subject: [PATCH] simplify --- fastcrypto/src/groups/mod.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fastcrypto/src/groups/mod.rs b/fastcrypto/src/groups/mod.rs index 0bab7f7dc6..ba6f752216 100644 --- a/fastcrypto/src/groups/mod.rs +++ b/fastcrypto/src/groups/mod.rs @@ -60,14 +60,7 @@ pub trait Doubling: Clone { /// Compute input * 2^repetitions by repeated doubling. fn repeated_doubling(&self, repetitions: u64) -> Self { - if repetitions == 0 { - return self.clone(); - } - let mut output = self.double(); - for _ in 1..repetitions { - output = output.double(); - } - output + (0..repetitions).fold(self.clone(), |acc, _| acc.double()) } }