Convert chain of conditional expressions into switch expressions.

This commit is contained in:
2022-11-14 01:06:06 +00:00
parent 7fbeaebfd3
commit a17a6e1788

View File

@@ -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;