diff --git a/BeefLibs/corlib/src/IComparable.bf b/BeefLibs/corlib/src/IComparable.bf index b58f8ca0..2c21f4e3 100644 --- a/BeefLibs/corlib/src/IComparable.bf +++ b/BeefLibs/corlib/src/IComparable.bf @@ -43,6 +43,11 @@ namespace System static Self operator+(Self lhs, Self rhs); } + interface IOpSubtractable + { + static Self operator-(Self lhs, Self rhs); + } + interface IOpNegatable { static Self operator-(Self value); diff --git a/BeefLibs/corlib/src/Int.bf b/BeefLibs/corlib/src/Int.bf index ad11b7a0..cfd81d8e 100644 --- a/BeefLibs/corlib/src/Int.bf +++ b/BeefLibs/corlib/src/Int.bf @@ -2,7 +2,7 @@ using System; namespace System { - struct Int : int, IInteger, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable + struct Int : int, IInteger, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable { public enum ParseError { @@ -21,6 +21,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Self operator-(Self value) { return (SelfBase)value; diff --git a/BeefLibs/corlib/src/Int16.bf b/BeefLibs/corlib/src/Int16.bf index 379d00d6..988e923b 100644 --- a/BeefLibs/corlib/src/Int16.bf +++ b/BeefLibs/corlib/src/Int16.bf @@ -1,6 +1,6 @@ namespace System { - struct Int16 : int16, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable + struct Int16 : int16, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable { public const int32 MaxValue = 0x7FFF; public const int32 MinValue = -0x8000; @@ -15,6 +15,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Self operator-(Self value) { return (SelfBase)value; diff --git a/BeefLibs/corlib/src/Int32.bf b/BeefLibs/corlib/src/Int32.bf index 40edb415..1beb6239 100644 --- a/BeefLibs/corlib/src/Int32.bf +++ b/BeefLibs/corlib/src/Int32.bf @@ -2,7 +2,7 @@ using System.Globalization; namespace System { - struct Int32 : int32, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable + struct Int32 : int32, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable { public enum ParseError { @@ -24,6 +24,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Self operator-(Self value) { return (SelfBase)value; diff --git a/BeefLibs/corlib/src/Int64.bf b/BeefLibs/corlib/src/Int64.bf index 300672df..7e486487 100644 --- a/BeefLibs/corlib/src/Int64.bf +++ b/BeefLibs/corlib/src/Int64.bf @@ -25,6 +25,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Int64 operator-(Int64 value) { return -(SelfBase)value; diff --git a/BeefLibs/corlib/src/Int8.bf b/BeefLibs/corlib/src/Int8.bf index 2ca5fe10..afb4a00f 100644 --- a/BeefLibs/corlib/src/Int8.bf +++ b/BeefLibs/corlib/src/Int8.bf @@ -1,6 +1,6 @@ namespace System { - struct Int8 : int8, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable + struct Int8 : int8, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable { public const int32 MaxValue = 0x7F; public const int32 MinValue = -0x80; @@ -15,6 +15,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Self operator-(Self value) { return (SelfBase)value; diff --git a/BeefLibs/corlib/src/UInt.bf b/BeefLibs/corlib/src/UInt.bf index 43d48847..c94623d6 100644 --- a/BeefLibs/corlib/src/UInt.bf +++ b/BeefLibs/corlib/src/UInt.bf @@ -1,6 +1,6 @@ namespace System { - struct UInt : uint, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable + struct UInt : uint, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable, IOpSubtractable { public enum ParseError { @@ -27,6 +27,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public int GetHashCode() { return (int)this; diff --git a/BeefLibs/corlib/src/UInt16.bf b/BeefLibs/corlib/src/UInt16.bf index 1664dc87..60bb40f6 100644 --- a/BeefLibs/corlib/src/UInt16.bf +++ b/BeefLibs/corlib/src/UInt16.bf @@ -1,6 +1,6 @@ namespace System { - struct UInt16 : uint16, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable + struct UInt16 : uint16, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable { public const uint16 MaxValue = (uint16)0xFFFF; public const uint16 MinValue = 0; @@ -15,6 +15,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Self operator-(Self value) { return (SelfBase)value; diff --git a/BeefLibs/corlib/src/UInt32.bf b/BeefLibs/corlib/src/UInt32.bf index 0da00fc9..32c73016 100644 --- a/BeefLibs/corlib/src/UInt32.bf +++ b/BeefLibs/corlib/src/UInt32.bf @@ -1,6 +1,6 @@ namespace System { - struct UInt32 : uint32, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable + struct UInt32 : uint32, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable, IOpSubtractable { public enum ParseError { @@ -22,6 +22,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public int GetHashCode() { return (int)this; diff --git a/BeefLibs/corlib/src/UInt64.bf b/BeefLibs/corlib/src/UInt64.bf index 44ed8c10..05586bbc 100644 --- a/BeefLibs/corlib/src/UInt64.bf +++ b/BeefLibs/corlib/src/UInt64.bf @@ -24,6 +24,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public int GetHashCode() { return (int)this; diff --git a/BeefLibs/corlib/src/UInt8.bf b/BeefLibs/corlib/src/UInt8.bf index 241007e1..cf70d256 100644 --- a/BeefLibs/corlib/src/UInt8.bf +++ b/BeefLibs/corlib/src/UInt8.bf @@ -1,6 +1,6 @@ namespace System { - struct UInt8 : uint8, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable + struct UInt8 : uint8, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable { public const uint8 MaxValue = (uint8)0xFF; public const uint8 MinValue = 0; @@ -15,6 +15,11 @@ namespace System return (SelfBase)lhs + (SelfBase)rhs; } + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + public static Self operator-(Self value) { return (SelfBase)value;