From 69ea2d571450fda207bb13212719b5b71d31928e Mon Sep 17 00:00:00 2001 From: Daniel Lehmann <59584561+danlehmann@users.noreply.github.com> Date: Fri, 26 May 2023 14:07:36 -0700 Subject: [PATCH] Let widen() officially support equal bit-widths as (due a bug) this was already allowed. (#25) While at it, remove SMALLER_THAN as the old definition is broken. We don't need it right now. --- src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f7d7280..a85e17d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,9 +97,6 @@ impl CompileTimeAssert { pub const SMALLER_OR_EQUAL: () = { assert!(A <= B); }; - pub const SMALLER_THAN: () = { - assert!(A <= B); - }; } #[derive(Copy, Clone, Eq, PartialEq, Default, Ord, PartialOrd)] @@ -328,7 +325,7 @@ macro_rules! uint_impl { pub const fn widen( self, ) -> UInt<$type, BITS_RESULT> { - let _ = CompileTimeAssert::::SMALLER_THAN; + let _ = CompileTimeAssert::::SMALLER_OR_EQUAL; // Query MAX of the result to ensure we get a compiler error if the current definition is bogus (e.g. ) let _ = UInt::<$type, BITS_RESULT>::MAX; UInt::<$type, BITS_RESULT> { value: self.value }