diff --git a/crates/library2/std/src/num/int/extend.fe b/crates/library2/std/src/num/int/extend.fe index 2e052ce7c..061bc3ce2 100644 --- a/crates/library2/std/src/num/int/extend.fe +++ b/crates/library2/std/src/num/int/extend.fe @@ -34,7 +34,7 @@ extern { } pub trait Extend { - fn extend(self) -> Out + fn extend(self) -> Out } impl Extend for u8 { fn extend(self) -> u16 { u8_u16_extend(self) } } @@ -66,4 +66,4 @@ impl Extend for i32 { fn extend(self) -> i128 { i32_i128_extend(self) } } impl Extend for i32 { fn extend(self) -> i256 { i32_i256_extend(self) } } impl Extend for i64 { fn extend(self) -> i128 { i64_i128_extend(self) } } impl Extend for i64 { fn extend(self) -> i256 { i64_i256_extend(self) } } -impl Extend for i128 { fn extend(self) -> i256 { i128_i256_extend(self) } } \ No newline at end of file +impl Extend for i128 { fn extend(self) -> i256 { i128_i256_extend(self) } } diff --git a/crates/library2/std/src/num/int/ops/arith.fe b/crates/library2/std/src/num/int/ops/arith.fe index 2dad574c5..02cfec1a0 100644 --- a/crates/library2/std/src/num/int/ops/arith.fe +++ b/crates/library2/std/src/num/int/ops/arith.fe @@ -1,159 +1,155 @@ use ingot::ops::arith::{ - Add, Sub, Div, Mul, Exp, - Mod, Shl, Shr, Minus, + Add, Sub, Div, Mul, Exp, + Mod, Shl, Shr, Neg, BitAnd, BitOr, BitNot } use ingot::num::int::{usize, isize} -extern { - fn abort() -> ! -} - -impl Add for i8 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for i16 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for i32 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for i64 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for i128 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for i256 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for u8 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for u16 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for u32 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for u64 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for u128 { fn add(self, rhs: Self) -> Self { abort() } } -impl Add for u256 { fn add(self, rhs: Self) -> Self { abort() } } +impl Add for i8 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for i16 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for i32 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for i64 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for i128 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for i256 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for u8 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for u16 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for u32 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for u64 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for u128 { fn add(self, rhs: Self) -> Self { self + rhs } } +impl Add for u256 { fn add(self, rhs: Self) -> Self { self + rhs } } -impl Sub for i8 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for i16 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for i32 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for i64 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for i128 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for i256 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for u8 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for u16 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for u32 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for u64 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for u128 { fn sub(self, rhs: Self) -> Self { abort() } } -impl Sub for u256 { fn sub(self, rhs: Self) -> Self { abort() } } +impl Sub for i8 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for i16 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for i32 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for i64 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for i128 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for i256 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for u8 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for u16 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for u32 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for u64 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for u128 { fn sub(self, rhs: Self) -> Self { self - rhs } } +impl Sub for u256 { fn sub(self, rhs: Self) -> Self { self - rhs } } -impl Mul for i8 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for i16 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for i32 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for i64 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for i128 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for i256 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for u8 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for u16 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for u32 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for u64 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for u128 { fn mul(self, rhs: Self) -> Self { abort() } } -impl Mul for u256 { fn mul(self, rhs: Self) -> Self { abort() } } +impl Mul for i8 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for i16 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for i32 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for i64 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for i128 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for i256 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for u8 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for u16 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for u32 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for u64 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for u128 { fn mul(self, rhs: Self) -> Self { self * rhs } } +impl Mul for u256 { fn mul(self, rhs: Self) -> Self { self * rhs } } -impl Div for i8 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for i16 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for i32 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for i64 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for i128 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for i256 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for u8 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for u16 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for u32 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for u64 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for u128 { fn div(self, rhs: Self) -> Self { abort() } } -impl Div for u256 { fn div(self, rhs: Self) -> Self { abort() } } +impl Div for i8 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for i16 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for i32 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for i64 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for i128 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for i256 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for u8 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for u16 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for u32 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for u64 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for u128 { fn div(self, rhs: Self) -> Self { self / rhs } } +impl Div for u256 { fn div(self, rhs: Self) -> Self { self / rhs } } -impl Exp for i8 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for i16 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for i32 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for i64 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for i128 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for i256 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for u8 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for u16 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for u32 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for u64 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for u128 { fn exp(self, rhs: Self) -> Self { abort() } } -impl Exp for u256 { fn exp(self, rhs: Self) -> Self { abort() } } +impl Exp for i8 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for i16 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for i32 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for i64 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for i128 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for i256 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for u8 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for u16 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for u32 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for u64 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for u128 { fn exp(self, rhs: Self) -> Self { self ** rhs } } +impl Exp for u256 { fn exp(self, rhs: Self) -> Self { self ** rhs } } -impl Mod for i8 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for i16 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for i32 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for i64 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for i128 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for i256 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for u8 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for u16 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for u32 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for u64 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for u128 { fn modulo(self, rhs: Self) -> Self { abort() } } -impl Mod for u256 { fn modulo(self, rhs: Self) -> Self { abort() } } +impl Mod for i8 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for i16 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for i32 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for i64 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for i128 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for i256 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for u8 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for u16 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for u32 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for u64 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for u128 { fn modulo(self, rhs: Self) -> Self { self % rhs } } +impl Mod for u256 { fn modulo(self, rhs: Self) -> Self { self % rhs } } -impl Shl for i8 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for i16 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for i32 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for i64 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for i128 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for i256 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for u8 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for u16 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for u32 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for u64 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for u128 { fn shl(self, rhs: usize) -> Self { abort() } } -impl Shl for u256 { fn shl(self, rhs: usize) -> Self { abort() } } +impl Shl for i8 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for i16 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for i32 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for i64 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for i128 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for i256 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for u8 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for u16 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for u32 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for u64 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for u128 { fn shl(self, rhs: Self) -> Self { self << rhs } } +impl Shl for u256 { fn shl(self, rhs: Self) -> Self { self << rhs } } -impl Shr for i16 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for i32 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for i64 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for i128 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for i256 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for u8 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for u16 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for u32 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for u64 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for u128 { fn shr(self, rhs: usize) -> Self { abort() } } -impl Shr for u256 { fn shr(self, rhs: usize) -> Self { abort() } } +impl Shr for i16 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for i32 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for i64 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for i128 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for i256 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for u8 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for u16 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for u32 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for u64 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for u128 { fn shr(self, rhs: Self) -> Self { self >> rhs } } +impl Shr for u256 { fn shr(self, rhs: Self) -> Self { self >> rhs } } -impl BitAnd for i8 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for i16 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for i32 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for i64 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for i128 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for i256 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for u8 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for u16 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for u32 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for u64 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for u128 { fn bit_and(self, rhs: Self) -> Self { abort() } } -impl BitAnd for u256 { fn bit_and(self, rhs: Self) -> Self { abort() } } +impl BitAnd for i8 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for i16 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for i32 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for i64 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for i128 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for i256 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for u8 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for u16 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for u32 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for u64 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for u128 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } +impl BitAnd for u256 { fn bit_and(self, rhs: Self) -> Self { self & rhs } } -impl BitOr for i8 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for i16 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for i32 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for i64 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for i128 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for i256 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for u8 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for u16 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for u32 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for u64 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for u128 { fn bit_or(self, rhs: Self) -> Self { abort() } } -impl BitOr for u256 { fn bit_or(self, rhs: Self) -> Self { abort() } } +impl BitOr for i8 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for i16 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for i32 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for i64 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for i128 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for i256 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for u8 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for u16 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for u32 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for u64 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for u128 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } +impl BitOr for u256 { fn bit_or(self, rhs: Self) -> Self { self | rhs } } -impl BitNot for i8 { fn bit_not(self) -> Self { abort() } } -impl BitNot for i16 { fn bit_not(self) -> Self { abort() } } -impl BitNot for i32 { fn bit_not(self) -> Self { abort() } } -impl BitNot for i64 { fn bit_not(self) -> Self { abort() } } -impl BitNot for i128 { fn bit_not(self) -> Self { abort() } } -impl BitNot for i256 { fn bit_not(self) -> Self { abort() } } -impl BitNot for u8 { fn bit_not(self) -> Self { abort() } } -impl BitNot for u16 { fn bit_not(self) -> Self { abort() } } -impl BitNot for u32 { fn bit_not(self) -> Self { abort() } } -impl BitNot for u64 { fn bit_not(self) -> Self { abort() } } -impl BitNot for u128 { fn bit_not(self) -> Self { abort() } } -impl BitNot for u256 { fn bit_not(self) -> Self { abort() } } +impl BitNot for i8 { fn bit_not(self) -> Self { ~self } } +impl BitNot for i16 { fn bit_not(self) -> Self { ~self } } +impl BitNot for i32 { fn bit_not(self) -> Self { ~self } } +impl BitNot for i64 { fn bit_not(self) -> Self { ~self } } +impl BitNot for i128 { fn bit_not(self) -> Self { ~self } } +impl BitNot for i256 { fn bit_not(self) -> Self { ~self } } +impl BitNot for u8 { fn bit_not(self) -> Self { ~self } } +impl BitNot for u16 { fn bit_not(self) -> Self { ~self } } +impl BitNot for u32 { fn bit_not(self) -> Self { ~self } } +impl BitNot for u64 { fn bit_not(self) -> Self { ~self } } +impl BitNot for u128 { fn bit_not(self) -> Self { ~self } } +impl BitNot for u256 { fn bit_not(self) -> Self { ~self } } -impl Minus for i8 { fn minus(self) -> Self { abort() } } -impl Minus for i16 { fn minus(self) -> Self { abort() } } -impl Minus for i32 { fn minus(self) -> Self { abort() } } -impl Minus for i64 { fn minus(self) -> Self { abort() } } -impl Minus for i128 { fn minus(self) -> Self { abort() } } -impl Minus for i256 { fn minus(self) -> Self { abort() } } +impl Neg for i8 { fn neg(self) -> Self { -self } } +impl Neg for i16 { fn neg(self) -> Self { -self } } +impl Neg for i32 { fn neg(self) -> Self { -self } } +impl Neg for i64 { fn neg(self) -> Self { -self } } +impl Neg for i128 { fn neg(self) -> Self { -self } } +impl Neg for i256 { fn neg(self) -> Self { -self } } diff --git a/crates/library2/std/src/num/int/ops/cmp.fe b/crates/library2/std/src/num/int/ops/cmp.fe index c1e04fcf3..e69de29bb 100644 --- a/crates/library2/std/src/num/int/ops/cmp.fe +++ b/crates/library2/std/src/num/int/ops/cmp.fe @@ -1,82 +0,0 @@ -use ingot::ops::cmp::{Eq, NotEq, Lt, LtEq, Gt, Gt, GtEq} - -extern { - fn abort() -> ! -} - -impl Eq for i8 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for i16 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for i32 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for i64 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for i128 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for i256 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for u8 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for u16 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for u32 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for u64 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for u128 { fn eq(self, rhs: Self) -> Self { abort() } } -impl Eq for u256 { fn eq(self, rhs: Self) -> Self { abort() } } - -impl NotEq for i8 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for i16 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for i32 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for i64 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for i128 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for i256 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for u8 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for u16 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for u32 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for u64 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for u128 { fn not_eq(self, rhs: Self) -> Self { abort() } } -impl NotEq for u256 { fn not_eq(self, rhs: Self) -> Self { abort() } } - -impl Lt for i8 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for i16 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for i32 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for i64 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for i128 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for i256 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for u8 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for u16 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for u32 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for u64 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for u128 { fn lt(self, rhs: Self) -> Self { abort() } } -impl Lt for u256 { fn lt(self, rhs: Self) -> Self { abort() } } - -impl LtEq for i8 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for i16 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for i32 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for i64 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for i128 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for i256 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for u8 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for u16 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for u32 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for u64 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for u128 { fn lt_eq(self, rhs: Self) -> Self { abort() } } -impl LtEq for u256 { fn lt_eq(self, rhs: Self) -> Self { abort() } } - -impl Gt for i8 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for i16 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for i32 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for i64 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for i128 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for i256 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for u8 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for u16 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for u32 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for u64 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for u128 { fn gt(self, rhs: Self) -> Self { abort() } } -impl Gt for u256 { fn gt(self, rhs: Self) -> Self { abort() } } - -impl GtEq for i8 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for i16 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for i32 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for i64 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for i128 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for i256 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for u8 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for u16 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for u32 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for u64 { fn gt_eq(self, rhs: Self) -> Self { abort() } } -impl GtEq for u128 { fn gt_eq(self, rhs: Self) -> Self { abort() } } \ No newline at end of file diff --git a/crates/library2/std/src/ops/arith.fe b/crates/library2/std/src/ops/arith.fe index 69d43bfdf..03c3a2073 100644 --- a/crates/library2/std/src/ops/arith.fe +++ b/crates/library2/std/src/ops/arith.fe @@ -29,23 +29,18 @@ pub trait Exp { } /// Left shift (e.g. `x << y`) -pub trait Shl { - fn shl(self, rhs: RHS) -> Out +pub trait Shl { + fn shl(self, rhs: Self) -> Self } /// Right shift (e.g. `x >> y`) -pub trait Shr { - fn shr(self, rhs: RHS) -> Out +pub trait Shr { + fn shr(self, rhs: Self) -> Self } -/// Plus (e.g. `+x`) -pub trait Plus { - fn plus(self) -> Out -} - -/// Minus (e.g. `-x`) -pub trait Minus { - fn minus(self) -> Out +/// Neg (e.g. `-x`) +pub trait Neg { + fn neg(self) -> Out } /// Bitwise and (e.g. `x && y`) @@ -61,4 +56,4 @@ pub trait BitOr { /// Bitwise not (e.g. `~x`) pub trait BitNot { fn bit_not(self) -> Out -} \ No newline at end of file +} diff --git a/crates/library2/std/src/ops/logical.fe b/crates/library2/std/src/ops/logical.fe deleted file mode 100644 index 67d04f508..000000000 --- a/crates/library2/std/src/ops/logical.fe +++ /dev/null @@ -1,30 +0,0 @@ -extern { - fn abort() -> ! -} - -/// Logical and (e.g. `x && y`) -pub trait And { - fn and(self, rhs: RHS) -> Out -} - -/// Logical or (e.g. `x || y`) -pub trait Or { - fn or(self, rhs: RHS) -> Out -} - -/// Logical not (e.g. `!x`) -pub trait Not { - fn not(self) -> Out -} - -impl And for bool { - fn and(self, rhs: Self) -> Self { abort() } -} - -impl Or for bool { - fn or(self, rhs: Self) -> Self { abort() } -} - -impl Not for bool { - fn not(self) -> Self { abort() } -} \ No newline at end of file