mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Convert chain of conditional expressions into switch expressions.
This commit is contained in:
32
Marshal.cs
32
Marshal.cs
@@ -454,33 +454,29 @@ public static class Marshal
|
|||||||
{
|
{
|
||||||
char c = hex[i];
|
char c = hex[i];
|
||||||
|
|
||||||
if(c < '0' ||
|
if(c is < '0' or > '9' and < 'A' or > 'F' and < 'a' or > 'f')
|
||||||
c is > '9' and < 'A' ||
|
|
||||||
c is > 'F' and < 'a' ||
|
|
||||||
c > 'f')
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
c -= c is >= 'a' and <= 'f'
|
c -= c switch
|
||||||
? '\u0057'
|
{
|
||||||
: c is >= 'A' and <= 'F'
|
>= 'a' and <= 'f' => '\u0057',
|
||||||
? '\u0037'
|
>= 'A' and <= 'F' => '\u0037',
|
||||||
: '\u0030';
|
_ => '\u0030'
|
||||||
|
};
|
||||||
|
|
||||||
outBuf[(i - off) / 2] = (byte)(c << 4);
|
outBuf[(i - off) / 2] = (byte)(c << 4);
|
||||||
|
|
||||||
c = hex[i + 1];
|
c = hex[i + 1];
|
||||||
|
|
||||||
if(c < '0' ||
|
if(c is < '0' or > '9' and < 'A' or > 'F' and < 'a' or > 'f')
|
||||||
c is > '9' and < 'A' ||
|
|
||||||
c is > 'F' and < 'a' ||
|
|
||||||
c > 'f')
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
c -= c is >= 'a' and <= 'f'
|
c -= c switch
|
||||||
? '\u0057'
|
{
|
||||||
: c is >= 'A' and <= 'F'
|
>= 'a' and <= 'f' => '\u0057',
|
||||||
? '\u0037'
|
>= 'A' and <= 'F' => '\u0037',
|
||||||
: '\u0030';
|
_ => '\u0030'
|
||||||
|
};
|
||||||
|
|
||||||
outBuf[(i - off) / 2] += (byte)c;
|
outBuf[(i - off) / 2] += (byte)c;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user