未验证 提交 9836d5a1 编写于 作者: T Trayan Zapryanov 提交者: GitHub

Use stackalloc in NumberFormatterBase (#67003)

Co-authored-by: NTrayan Zapryanov <Traian.Zaprianov@docuware.com>
上级 c49593c0
......@@ -82,7 +82,7 @@ public static void ConvertToAlphabetic(StringBuilder sb, double val, char firstC
Debug.Assert(1 <= val && val <= MaxAlphabeticValue);
Debug.Assert(Math.Pow(totalChars, MaxAlphabeticLength) >= MaxAlphabeticValue);
char[] letters = new char[MaxAlphabeticLength];
Span<char> letters = stackalloc char[MaxAlphabeticLength];
int idx = MaxAlphabeticLength;
int number = (int)val;
......@@ -93,7 +93,7 @@ public static void ConvertToAlphabetic(StringBuilder sb, double val, char firstC
number = quot;
}
letters[--idx] = (char)(firstChar + --number);
sb.Append(letters, idx, MaxAlphabeticLength - idx);
sb.Append(letters.Slice(idx, MaxAlphabeticLength - idx));
}
protected const int MaxRomanValue = 32767;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册