From ab08e2c306962f639cc956c64151e807ba53a53a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 1 Aug 2024 21:36:35 +0000 Subject: [PATCH] Use Karatsuba mul less when built with `slower_smaller_binary` This is a less than 5% reduction in performance and reduces code size for the crypto module from 26.7KiB to 26.5KiB. --- src/crypto/bigint.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/crypto/bigint.rs b/src/crypto/bigint.rs index 8986869..1955775 100644 --- a/src/crypto/bigint.rs +++ b/src/crypto/bigint.rs @@ -431,7 +431,13 @@ macro_rules! define_mul { ($name: ident, $len: expr, $submul: ident) => { define_gradeschool_mul!(mul_4, 4, mul_2); #[cfg(not(feature = "slower_smaller_binary"))] define_gradeschool_mul!(mul_6, 6, mul_3); + +#[cfg(not(feature = "slower_smaller_binary"))] define_mul!(mul_8, 8, mul_4); + +#[cfg(feature = "slower_smaller_binary")] +define_gradeschool_mul!(mul_8, 8, mul_4); + define_mul!(mul_16, 16, mul_8); define_mul!(mul_32, 32, mul_16); define_mul!(mul_64, 64, mul_32); -- 2.39.5