1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Removed deprecated IOp* conformance, added missing consts and properties

This commit is contained in:
Brian Fiete 2020-08-29 07:10:04 -07:00
parent 783bdb15be
commit ffee0a2aa3
15 changed files with 67 additions and 30 deletions

View file

@ -1,6 +1,6 @@
namespace System
{
struct Char16 : char16, IHashable
struct Char16 : char16, IHashable, IIsNaN
{
const int UNICODE_PLANE00_END = 0x00ffff;
// The starting codepoint for Unicode plane 1. Plane 1 contains 0x010000 ~ 0x01ffff.
@ -14,6 +14,15 @@ namespace System
const char16 HIGH_SURROGATE_END = (char16)0xdbff;
const char16 LOW_SURROGATE_START = (char16)0xdc00;
bool IIsNaN.IsNaN
{
[SkipCall]
get
{
return false;
}
}
public int GetHashCode()
{
return (int)this;

View file

@ -1,12 +1,21 @@
namespace System
{
struct Char32 : char32, IHashable
struct Char32 : char32, IHashable, IIsNaN
{
public int GetHashCode()
{
return (int)this;
}
bool IIsNaN.IsNaN
{
[SkipCall]
get
{
return false;
}
}
public extern char32 ToLower
{
get;

View file

@ -1,13 +1,8 @@
namespace System
{
#unwarn
struct Char8 : char8, IHashable, IOpComparable, IIsNaN
struct Char8 : char8, IHashable, IIsNaN
{
public static int operator<=>(Char8 a, Char8 b)
{
return (char8)a <=> (char8)b;
}
bool IIsNaN.IsNaN
{
[SkipCall]

View file

@ -10,7 +10,7 @@ namespace System
using System.Diagnostics;
#unwarn
public struct Double : double, IFloating, ISigned, IFormattable, IHashable, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable, ICanBeNaN
public struct Double : double, IFloating, ISigned, IFormattable, IHashable, ICanBeNaN
{
public const double MinValue = -1.7976931348623157E+308;
public const double MaxValue = 1.7976931348623157E+308;
@ -65,7 +65,25 @@ namespace System
return *((int*)&d) ^ ((int32*)&d)[1];
}
public bool IsNegative
{
get
{
double val = (double)this;
return (*(uint64*)(&val) & 0x8000000000000000UL) == 0x8000000000000000UL;
}
}
public bool IsFinite
{
get
{
double val = (double)this;
return (*(int64*)(&val) & 0x7FFFFFFFFFFFFFFFL) < 0x7FF0000000000000L;
}
}
public bool IsInfinity
{
get
@ -91,15 +109,7 @@ namespace System
}
}
public bool IsNegative
{
get
{
double val = (double)this;
return (*(uint64*)(&val) & 0x8000000000000000UL) == 0x8000000000000000UL;
}
}
public bool IsNaN
{
get
@ -109,6 +119,17 @@ namespace System
}
}
public bool IsSubnormal
{
get
{
double val = (double)this;
var bits = *(int64*)(&val);
bits &= 0x7FFFFFFFFFFFFFFFUL;
return (bits < 0x7F80000000000000UL) && (bits != 0) && ((bits & 0x7F80000000000000UL) == 0);
}
}
// Compares this object to another object, returning an instance of System.Relation.
// Null is considered less than any instance.
//

View file

@ -3,7 +3,7 @@ using System.Globalization;
namespace System
{
#unwarn
struct Float : float, IFloating, ISigned, IFormattable, IHashable, IEquatable<float>, IOpComparable, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable, ICanBeNaN
struct Float : float, IFloating, ISigned, IFormattable, IHashable, IEquatable<float>, ICanBeNaN
{
public const float MinValue = (float)-3.40282346638528859e+38;
public const float Epsilon = (float)1.4e-45;

View file

@ -3,7 +3,7 @@ using System;
namespace System
{
#unwarn
struct Int : int, IInteger, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct Int : int, IInteger, IHashable, IFormattable, IIsNaN
{
public enum ParseError
{
@ -12,6 +12,9 @@ namespace System
case InvalidChar(int partialResult);
}
public const int MaxValue = (sizeof(uint) == 8) ? 0x7FFFFFFFFFFFFFFFL : 0x7FFFFFFF;
public const int MinValue = (sizeof(uint) == 8) ? -0x8000000000000000L : -0x80000000;
public static int operator<=>(Self a, Self b)
{
return (SelfBase)a <=> (SelfBase)b;

View file

@ -1,7 +1,7 @@
namespace System
{
#unwarn
struct Int16 : int16, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct Int16 : int16, IInteger, ISigned, IHashable, IFormattable, IIsNaN
{
public const int32 MaxValue = 0x7FFF;
public const int32 MinValue = -0x8000;

View file

@ -3,7 +3,7 @@ using System.Globalization;
namespace System
{
#unwarn
struct Int32 : int32, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct Int32 : int32, IInteger, ISigned, IHashable, IFormattable, IIsNaN
{
public enum ParseError
{

View file

@ -3,7 +3,7 @@ using System.Globalization;
namespace System
{
#unwarn
struct Int64 : int64, IInteger, ISigned, IFormattable, IHashable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct Int64 : int64, IInteger, ISigned, IFormattable, IHashable, IIsNaN
{
public enum ParseError
{

View file

@ -1,7 +1,7 @@
namespace System
{
#unwarn
struct Int8 : int8, IInteger, ISigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct Int8 : int8, IInteger, ISigned, IHashable, IFormattable, IIsNaN
{
public const int32 MaxValue = 0x7F;
public const int32 MinValue = -0x80;

View file

@ -1,7 +1,7 @@
namespace System
{
#unwarn
struct UInt : uint, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable, IOpSubtractable
struct UInt : uint, IInteger, IUnsigned, IHashable, IFormattable, IIsNaN
{
public enum ParseError
{

View file

@ -1,7 +1,7 @@
namespace System
{
#unwarn
struct UInt16 : uint16, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct UInt16 : uint16, IInteger, IUnsigned, IHashable, IFormattable, IIsNaN
{
public const uint16 MaxValue = (uint16)0xFFFF;
public const uint16 MinValue = 0;

View file

@ -1,7 +1,7 @@
namespace System
{
#unwarn
struct UInt32 : uint32, IInteger, IUnsigned, IHashable, IOpComparable, IFormattable, IIsNaN, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct UInt32 : uint32, IInteger, IUnsigned, IHashable, IFormattable, IIsNaN
{
public enum ParseError
{

View file

@ -3,7 +3,7 @@ using System.Globalization;
namespace System
{
#unwarn
struct UInt64 : uint64, IInteger, IUnsigned, IHashable, IOpComparable, IIsNaN, IFormattable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct UInt64 : uint64, IInteger, IUnsigned, IHashable, IIsNaN, IFormattable
{
public const uint64 MaxValue = 0xFFFFFFFFFFFFFFFFUL;
public const uint64 MinValue = 0;

View file

@ -1,7 +1,7 @@
namespace System
{
#unwarn
struct UInt8 : uint8, IInteger, IUnsigned, IHashable, IFormattable, IOpComparable, IIsNaN, IOpNegatable, IOpAddable, IOpSubtractable, IOpMultiplicable, IOpDividable
struct UInt8 : uint8, IInteger, IUnsigned, IHashable, IFormattable, IIsNaN
{
public const uint8 MaxValue = (uint8)0xFF;
public const uint8 MinValue = 0;