diff --git a/BeefLibs/corlib/src/Double.bf b/BeefLibs/corlib/src/Double.bf index 0b3acecc..db8a59fa 100644 --- a/BeefLibs/corlib/src/Double.bf +++ b/BeefLibs/corlib/src/Double.bf @@ -9,7 +9,7 @@ namespace System using System.Diagnostics.Contracts; using System.Diagnostics; - public struct Double : double, IFloating, ISigned, IFormattable, IHashable, IOpComparable, IOpNegatable, ICanBeNaN + public struct Double : double, IFloating, ISigned, IFormattable, IHashable, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable, ICanBeNaN { public const double MinValue = -1.7976931348623157E+308; public const double MaxValue = 1.7976931348623157E+308; @@ -33,6 +33,26 @@ namespace System return (double)value; } + public static Self operator+(Self lhs, Self rhs) + { + return (SelfBase)lhs + (SelfBase)rhs; + } + + public static Self operator-(Self lhs, Self rhs) + { + return (SelfBase)lhs - (SelfBase)rhs; + } + + public static Self operator*(Self lhs, Self rhs) + { + return (SelfBase)lhs * (SelfBase)rhs; + } + + public static Self operator/(Self lhs, Self rhs) + { + return (SelfBase)lhs / (SelfBase)rhs; + } + public int GetHashCode() { double d = (double)this; diff --git a/BeefLibs/corlib/src/Float.bf b/BeefLibs/corlib/src/Float.bf index 1c829fe6..07174078 100644 --- a/BeefLibs/corlib/src/Float.bf +++ b/BeefLibs/corlib/src/Float.bf @@ -2,7 +2,7 @@ using System.Globalization; namespace System { - struct Float : float, IFloating, ISigned, IFormattable, IHashable, IEquatable, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, ICanBeNaN + struct Float : float, IFloating, ISigned, IFormattable, IHashable, IEquatable, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable, ICanBeNaN { public const float MinValue = (float)-3.40282346638528859e+38; public const float Epsilon = (float)1.4e-45; @@ -34,6 +34,16 @@ 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 lhs, Self rhs) + { + return (SelfBase)lhs / (SelfBase)rhs; + } + /*public bool IsNegative { get diff --git a/BeefLibs/corlib/src/IComparable.bf b/BeefLibs/corlib/src/IComparable.bf index 50709105..1d7f7d77 100644 --- a/BeefLibs/corlib/src/IComparable.bf +++ b/BeefLibs/corlib/src/IComparable.bf @@ -48,6 +48,16 @@ namespace System static Self operator-(Self lhs, Self rhs); } + interface IOpMultiplicable + { + static Self operator*(Self lhs, Self rhs); + } + + interface IOpDividable + { + 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 cfd81d8e..07d373eb 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, IOpSubtractable + struct Int : int, IInteger, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public enum ParseError { @@ -31,6 +31,16 @@ namespace System return (SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + 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/Int16.bf b/BeefLibs/corlib/src/Int16.bf index c0416a7a..770836dc 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, IOpSubtractable + struct Int16 : int16, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public const int32 MaxValue = 0x7FFF; public const int32 MinValue = -0x8000; @@ -25,6 +25,16 @@ namespace System return (SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + 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/Int32.bf b/BeefLibs/corlib/src/Int32.bf index 57f9c01c..7302ac3a 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, IOpSubtractable + struct Int32 : int32, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public enum ParseError { @@ -34,6 +34,16 @@ namespace System return (SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + 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/Int64.bf b/BeefLibs/corlib/src/Int64.bf index 31f19ed5..727391ee 100644 --- a/BeefLibs/corlib/src/Int64.bf +++ b/BeefLibs/corlib/src/Int64.bf @@ -2,7 +2,7 @@ using System.Globalization; namespace System { - struct Int64 : int64, IInteger, ISigned, IFormattable, IHashable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable + struct Int64 : int64, IInteger, ISigned, IFormattable, IHashable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public enum ParseError { @@ -34,6 +34,16 @@ namespace System return -(SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + return (SelfBase)lhs * (SelfBase)rhs; + } + + public static Self operator/(Self lhs, Self rhs) + { + return (SelfBase)lhs / (SelfBase)rhs; + } + public int GetHashCode() { return (int)(int64)this; diff --git a/BeefLibs/corlib/src/Int8.bf b/BeefLibs/corlib/src/Int8.bf index a0f711aa..4f9136ec 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, IOpSubtractable + struct Int8 : int8, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public const int32 MaxValue = 0x7F; public const int32 MinValue = -0x80; @@ -25,6 +25,16 @@ namespace System return (SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + 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/UInt.bf b/BeefLibs/corlib/src/UInt.bf index c94623d6..00441b03 100644 --- a/BeefLibs/corlib/src/UInt.bf +++ b/BeefLibs/corlib/src/UInt.bf @@ -32,6 +32,16 @@ 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 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 f2df3640..4a501efc 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, IOpSubtractable + struct UInt16 : uint16, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public const uint16 MaxValue = (uint16)0xFFFF; public const uint16 MinValue = 0; @@ -25,6 +25,16 @@ namespace System return (SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + 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/UInt32.bf b/BeefLibs/corlib/src/UInt32.bf index 6b3da0d4..57c11ce5 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, IOpSubtractable + struct UInt32 : uint32, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public enum ParseError { @@ -27,6 +27,16 @@ 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 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 8da9998c..1edd4441 100644 --- a/BeefLibs/corlib/src/UInt64.bf +++ b/BeefLibs/corlib/src/UInt64.bf @@ -2,7 +2,7 @@ using System.Globalization; namespace System { - struct UInt64 : uint64, IInteger, IUnsigned, IHashable, IOpComparable, IIsNaN, IFormattable, IOpAddable, IOpSubtractable + struct UInt64 : uint64, IInteger, IUnsigned, IHashable, IOpComparable, IIsNaN, IFormattable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public const uint64 MaxValue = 0xFFFFFFFFFFFFFFFFUL; public const uint64 MinValue = 0; @@ -29,6 +29,16 @@ 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 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 f24c827c..9f63610e 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, IOpSubtractable + struct UInt8 : uint8, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable { public const uint8 MaxValue = (uint8)0xFF; public const uint8 MinValue = 0; @@ -25,6 +25,16 @@ namespace System return (SelfBase)value; } + public static Self operator*(Self lhs, Self rhs) + { + return (SelfBase)lhs * (SelfBase)rhs; + } + + public static Self operator/(Self lhs, Self rhs) + { + return (SelfBase)lhs / (SelfBase)rhs; + } + public int GetHashCode() { return (int)this;