mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Added INumeric
This commit is contained in:
parent
0b71897461
commit
f874535a13
3 changed files with 20 additions and 5 deletions
|
@ -18,11 +18,16 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IInteger
|
interface INumeric
|
||||||
|
{
|
||||||
|
static Self operator+(Self lhs, Self rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IInteger : INumeric
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IUnsigned
|
interface IUnsigned : INumeric
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,17 @@ namespace System
|
||||||
|
|
||||||
public static int operator<=>(Int64 a, Int64 b)
|
public static int operator<=>(Int64 a, Int64 b)
|
||||||
{
|
{
|
||||||
return (int64)a <=> (int64)b;
|
return (SelfBase)a <=> (SelfBase)b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Self operator+(Self lhs, Self rhs)
|
||||||
|
{
|
||||||
|
return (SelfBase)lhs + (SelfBase)rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Int64 operator-(Int64 value)
|
public static Int64 operator-(Int64 value)
|
||||||
{
|
{
|
||||||
return (int64)value;
|
return -(SelfBase)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IHashable.GetHashCode()
|
int IHashable.GetHashCode()
|
||||||
|
|
|
@ -16,7 +16,12 @@ namespace System
|
||||||
|
|
||||||
public static int operator<=>(UInt64 a, UInt64 b)
|
public static int operator<=>(UInt64 a, UInt64 b)
|
||||||
{
|
{
|
||||||
return (uint64)a <=> (uint64)b;
|
return (SelfBase)a <=> (SelfBase)b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Self operator+(Self lhs, Self rhs)
|
||||||
|
{
|
||||||
|
return (SelfBase)lhs + (SelfBase)rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IHashable.GetHashCode()
|
int IHashable.GetHashCode()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue