We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 612b14d commit 04da5f5Copy full SHA for 04da5f5
substrate/frame/revive/src/vm/evm/instructions/arithmetic/i256.rs
@@ -27,7 +27,6 @@ pub enum Sign {
27
Minus = -1,
28
/// Zero value sign
29
Zero = 0,
30
- #[allow(dead_code)] // "constructed" with `mem::transmute` in `i256_sign` below
31
/// Positive value sign
32
Plus = 1,
33
}
@@ -43,9 +42,10 @@ const FLIPH_BITMASK_U64: u64 = 0x7FFF_FFFF_FFFF_FFFF;
43
42
pub fn i256_sign(val: &U256) -> Sign {
44
if val.bit(255) {
45
Sign::Minus
+ } else if val.is_zero() {
46
+ Sign::Zero
47
} else {
- // SAFETY: false == 0 == Zero, true == 1 == Plus
48
- unsafe { core::mem::transmute::<bool, Sign>(!val.is_zero()) }
+ Sign::Plus
49
50
51
0 commit comments