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

Rework hex parsing flags. New 'Hex' flag, 'AllowHexSpecifier' allows hex

This commit is contained in:
Brian Fiete 2023-06-22 07:52:43 -04:00
parent 4ab140a4f4
commit 269716c0d4
11 changed files with 23 additions and 22 deletions

View file

@ -692,11 +692,11 @@ namespace System.Globalization {
}
// private const NumberStyles InvalidNumberStyles = unchecked((NumberStyles) 0xFFFFFC00);
private const NumberStyles InvalidNumberStyles = ~(NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite
| NumberStyles.AllowLeadingSign | NumberStyles.AllowTrailingSign
| NumberStyles.AllowParentheses | NumberStyles.AllowDecimalPoint
| NumberStyles.AllowThousands | NumberStyles.AllowExponent
| NumberStyles.AllowCurrencySymbol | NumberStyles.AllowHexSpecifier);
private const NumberStyles InvalidNumberStyles = ~(.AllowLeadingWhite | .AllowTrailingWhite
| .AllowLeadingSign | .AllowTrailingSign
| .AllowParentheses | .AllowDecimalPoint
| .AllowThousands | .AllowExponent
| .AllowCurrencySymbol | .AllowHexSpecifier | .Hex);
/*internal static void ValidateParseStyleInteger(NumberStyles style) {
// Check for undefined flags

View file

@ -45,10 +45,11 @@ namespace System.Globalization
AllowHexSpecifier = 0x00000200, //Allow specifiying hexadecimal.
//Common uses. These represent some of the most common combinations of these flags.
Hex = 0x00000400,
Integer = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign,
HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier,
HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier | Hex,
Number = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
AllowDecimalPoint | AllowThousands,

View file

@ -85,7 +85,7 @@ namespace System
bool isNeg = false;
int16 result = 0;
int16 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
int16 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -134,7 +134,7 @@ namespace System
bool isNeg = false;
int32 result = 0;
int32 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
int32 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -115,7 +115,7 @@ namespace System
bool isNeg = false;
int64 result = 0;
int64 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
int64 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -85,7 +85,7 @@ namespace System
bool isNeg = false;
int8 result = 0;
int8 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
int8 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -85,7 +85,7 @@ namespace System
uint16 result = 0;
uint16 prevResult = 0;
uint16 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
uint16 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -113,7 +113,7 @@ namespace System
uint32 result = 0;
uint32 prevResult = 0;
uint32 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
uint32 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -97,7 +97,7 @@ namespace System
uint64 result = 0;
uint64 prevResult = 0;
uint64 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
uint64 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{

View file

@ -85,7 +85,7 @@ namespace System
uint8 result = 0;
uint8 prevResult = 0;
uint8 radix = style.HasFlag(.AllowHexSpecifier) ? 0x10 : 10;
uint8 radix = style.HasFlag(.Hex) ? 0x10 : 10;
for (int32 i = 0; i < val.Length; i++)
{