diff --git a/corelib/src/integer.cairo b/corelib/src/integer.cairo index d4480372294..48acbefd722 100644 --- a/corelib/src/integer.cairo +++ b/corelib/src/integer.cairo @@ -1929,6 +1929,13 @@ impl I8SubEq of SubEq { } } +impl I8Neg of Neg { + #[inline(always)] + fn neg(a: i8) -> i8 { + 0 - a + } +} + extern fn i8_wide_mul(lhs: i8, rhs: i8) -> i16 implicits() nopanic; impl I8Mul of Mul { fn mul(lhs: i8, rhs: i8) -> i8 { @@ -2021,6 +2028,13 @@ impl I16SubEq of SubEq { } } +impl I16Neg of Neg { + #[inline(always)] + fn neg(a: i16) -> i16 { + 0 - a + } +} + extern fn i16_wide_mul(lhs: i16, rhs: i16) -> i32 implicits() nopanic; impl I16Mul of Mul { fn mul(lhs: i16, rhs: i16) -> i16 { @@ -2113,6 +2127,13 @@ impl I32SubEq of SubEq { } } +impl I32Neg of Neg { + #[inline(always)] + fn neg(a: i32) -> i32 { + 0 - a + } +} + extern fn i32_wide_mul(lhs: i32, rhs: i32) -> i64 implicits() nopanic; impl I32Mul of Mul { fn mul(lhs: i32, rhs: i32) -> i32 { @@ -2205,6 +2226,13 @@ impl I64SubEq of SubEq { } } +impl I64Neg of Neg { + #[inline(always)] + fn neg(a: i64) -> i64 { + 0 - a + } +} + extern fn i64_wide_mul(lhs: i64, rhs: i64) -> i128 implicits() nopanic; impl I64Mul of Mul { fn mul(lhs: i64, rhs: i64) -> i64 { @@ -2297,6 +2325,12 @@ impl I128SubEq of SubEq { } } +impl I128Neg of Neg { + #[inline(always)] + fn neg(a: i128) -> i128 { + 0 - a + } +} /// If `lhs` >= `rhs` returns `Ok(lhs - rhs)` else returns `Err(2**128 + lhs - rhs)`. extern fn i128_diff(lhs: i128, rhs: i128) -> Result implicits(RangeCheck) nopanic;