1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-19 08:30:25 +02:00
Beef/BeefLibs/corlib/src/UInt8.bf

70 lines
1.3 KiB
Beef

namespace System
{
#unwarn
struct UInt8 : uint8, IInteger, IUnsigned, IHashable, IFormattable, IIsNaN
{
public const uint8 MaxValue = (uint8)0xFF;
public const uint8 MinValue = 0;
public static int operator<=>(Self a, Self b)
{
return (SelfBase)a <=> (SelfBase)b;
}
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 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()
{
return (int)this;
}
bool IIsNaN.IsNaN
{
[SkipCall]
get
{
return false;
}
}
public override void ToString(String outString)
{
((uint32)this).ToString(outString);
}
public void ToString(String outString, String format, IFormatProvider formatProvider)
{
if(format == null || format.IsEmpty)
{
ToString(outString);
}
else
{
NumberFormatter.NumberToString(format, (uint32)this, formatProvider, outString);
}
}
}
}