From 7218598a96022ad4b7d98ad08f83795ec95d68c5 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 4 Sep 2025 22:24:47 +0200 Subject: adjust types of e() Taking j as i32 was a weird choice (only for the -1), and technically caused issues for invocations with more than u16::MAX tweaks (not that people might use that many tweaks, but just in case...) --- src/block.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/block.rs') diff --git a/src/block.rs b/src/block.rs index 2b7907a..8d6517d 100644 --- a/src/block.rs +++ b/src/block.rs @@ -115,7 +115,7 @@ impl Block { /// Computes self * 2^exponent /// /// Ensures that there's no overflow in computing 2^exponent. - pub fn exp(&self, exponent: u32) -> Block { + pub fn exp(&self, exponent: usize) -> Block { match exponent { _ if exponent < 32 => *self * (1 << exponent), _ if exponent % 2 == 0 => self.exp(exponent / 2).exp(exponent / 2), @@ -266,9 +266,9 @@ impl IndexMut for Block { } } -impl Mul for Block { +impl Mul for Block { type Output = Block; - fn mul(self, rhs: u32) -> Block { + fn mul(self, rhs: usize) -> Block { match rhs { 0 => Block::null(), 1 => self, -- cgit v1.2.3