From 4924148dc62b8fc206dce560db589edf2d651ae7 Mon Sep 17 00:00:00 2001 From: junderw Date: Fri, 17 Mar 2023 13:35:33 -0700 Subject: [PATCH] Swap out `Work::log2` implementation for `U256::to_f64` --- bitcoin/src/pow.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs index c8a59a6c..9e400b76 100644 --- a/bitcoin/src/pow.rs +++ b/bitcoin/src/pow.rs @@ -92,12 +92,7 @@ impl Work { /// `log2_work` output in its logs. #[cfg(feature = "std")] #[cfg_attr(docsrs, doc(cfg(feature = "std")))] - pub fn log2(self) -> f64 { - let U256(high, low) = self.0; - // 2^128 * high + low - let double = (3402823669209385e23_f64 * high as f64) + (low as f64); - double.log2() - } + pub fn log2(self) -> f64 { self.0.to_f64().log2() } } do_impl!(Work);