Skip to content

Commit 8821c51

Browse files
committed
Fix a build error
1 parent 4b8841e commit 8821c51

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/libraries/System.Private.CoreLib/src/System/Number.Dragon4.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ private static uint Dragon4(ulong mantissa, int exponent, uint mantissaHighBitId
154154
// scaledMarginLow = 2 * 2^(-1)
155155
BigInteger.SetUInt32(out scaledMarginLow, 1);
156156
}
157+
158+
// This is unused for this path, but we need it viewed as "initialized" so the
159+
// scaledMarginHigh tracking works as expected.
160+
Unsafe.SkipInit(out optionalMarginHigh);
157161
}
158162

159163
scoped ref BigInteger scaledMarginHigh = ref (hasUnequalMargins ? ref optionalMarginHigh : ref scaledMarginLow);

src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,11 @@ private static int GetFloatingPointMaxDigitsAndPrecision(char fmt, ref int preci
418418
// We want to fast path the common case of no format and general format + precision.
419419
// These are commonly encountered and the full switch is otherwise large enough to show up in hot path profiles
420420

421-
fmt |= 0x20;
421+
// Bitwise-or with space (' ') converts null ('\0') to space, any uppercase character to lowercase
422+
// and other unsupported characters to something else unsupported.
423+
fmt |= ' ';
422424

423-
if ((fmt == 0x20) || (fmt == 'g'))
425+
if ((fmt == ' ') || (fmt == 'g'))
424426
{
425427
// The general format uses the precision specifier to indicate the number of significant
426428
// digits to format. This defaults to the shortest roundtrippable string. Additionally,

0 commit comments

Comments
 (0)