mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 08:30:25 +02:00
Added IOpMultiplicable and IOpDividable, fixed Double not implementing IOpAddable and IOpSubtractable
This commit is contained in:
parent
5d9a5f183d
commit
862c15241a
13 changed files with 151 additions and 11 deletions
|
@ -9,7 +9,7 @@ namespace System
|
||||||
using System.Diagnostics.Contracts;
|
using System.Diagnostics.Contracts;
|
||||||
using System.Diagnostics;
|
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 MinValue = -1.7976931348623157E+308;
|
||||||
public const double MaxValue = 1.7976931348623157E+308;
|
public const double MaxValue = 1.7976931348623157E+308;
|
||||||
|
@ -33,6 +33,26 @@ namespace System
|
||||||
return (double)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
double d = (double)this;
|
double d = (double)this;
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.Globalization;
|
||||||
|
|
||||||
namespace System
|
namespace System
|
||||||
{
|
{
|
||||||
struct Float : float, IFloating, ISigned, IFormattable, IHashable, IEquatable<float>, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, ICanBeNaN
|
struct Float : float, IFloating, ISigned, IFormattable, IHashable, IEquatable<float>, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable, ICanBeNaN
|
||||||
{
|
{
|
||||||
public const float MinValue = (float)-3.40282346638528859e+38;
|
public const float MinValue = (float)-3.40282346638528859e+38;
|
||||||
public const float Epsilon = (float)1.4e-45;
|
public const float Epsilon = (float)1.4e-45;
|
||||||
|
@ -34,6 +34,16 @@ namespace System
|
||||||
return (SelfBase)lhs - (SelfBase)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 bool IsNegative
|
/*public bool IsNegative
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -48,6 +48,16 @@ namespace System
|
||||||
static Self operator-(Self lhs, Self rhs);
|
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
|
interface IOpNegatable
|
||||||
{
|
{
|
||||||
static Self operator-(Self value);
|
static Self operator-(Self value);
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
|
|
||||||
namespace 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
|
public enum ParseError
|
||||||
{
|
{
|
||||||
|
@ -31,6 +31,16 @@ namespace System
|
||||||
return (SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System
|
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 MaxValue = 0x7FFF;
|
||||||
public const int32 MinValue = -0x8000;
|
public const int32 MinValue = -0x8000;
|
||||||
|
@ -25,6 +25,16 @@ namespace System
|
||||||
return (SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.Globalization;
|
||||||
|
|
||||||
namespace System
|
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
|
public enum ParseError
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,16 @@ namespace System
|
||||||
return (SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.Globalization;
|
||||||
|
|
||||||
namespace System
|
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
|
public enum ParseError
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,16 @@ namespace System
|
||||||
return -(SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)(int64)this;
|
return (int)(int64)this;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System
|
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 MaxValue = 0x7F;
|
||||||
public const int32 MinValue = -0x80;
|
public const int32 MinValue = -0x80;
|
||||||
|
@ -25,6 +25,16 @@ namespace System
|
||||||
return (SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -32,6 +32,16 @@ namespace System
|
||||||
return (SelfBase)lhs - (SelfBase)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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System
|
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 MaxValue = (uint16)0xFFFF;
|
||||||
public const uint16 MinValue = 0;
|
public const uint16 MinValue = 0;
|
||||||
|
@ -25,6 +25,16 @@ namespace System
|
||||||
return (SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System
|
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
|
public enum ParseError
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,16 @@ namespace System
|
||||||
return (SelfBase)lhs - (SelfBase)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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.Globalization;
|
||||||
|
|
||||||
namespace System
|
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 MaxValue = 0xFFFFFFFFFFFFFFFFUL;
|
||||||
public const uint64 MinValue = 0;
|
public const uint64 MinValue = 0;
|
||||||
|
@ -29,6 +29,16 @@ namespace System
|
||||||
return (SelfBase)lhs - (SelfBase)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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System
|
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 MaxValue = (uint8)0xFF;
|
||||||
public const uint8 MinValue = 0;
|
public const uint8 MinValue = 0;
|
||||||
|
@ -25,6 +25,16 @@ namespace System
|
||||||
return (SelfBase)value;
|
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()
|
public int GetHashCode()
|
||||||
{
|
{
|
||||||
return (int)this;
|
return (int)this;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue