mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 23:04:09 +02:00
More const eval progress
This commit is contained in:
parent
a3ea79cd62
commit
9b80c26d0a
26 changed files with 1673 additions and 460 deletions
|
@ -109,7 +109,7 @@ namespace System
|
|||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
};*/
|
||||
|
||||
private static uint64[2048] MantissaBitsTable = .(
|
||||
private const uint64[2048] MantissaBitsTable = .(
|
||||
4556951262222748432UL, 9113902524445496865UL, 1822780504889099373UL,
|
||||
3645561009778198746UL, 7291122019556397492UL, 14582244039112794984UL,
|
||||
2916448807822558996UL, 5832897615645117993UL, 11665795231290235987UL,
|
||||
|
@ -794,7 +794,7 @@ namespace System
|
|||
4602094425247528723UL, 9204188850495057447UL, 1840837770099011489UL,
|
||||
3681675540198022979UL, 7363351080396045958UL);
|
||||
|
||||
private static int32[2048] TensExponentTable = .(
|
||||
private const int32[2048] TensExponentTable = .(
|
||||
-323, -323, -322, -322, -322, -322, -321, -321, -321, -320, -320, -320,
|
||||
-319, -319, -319, -319, -318, -318, -318, -317, -317, -317, -316, -316,
|
||||
-316, -316, -315, -315, -315, -314, -314, -314, -313, -313, -313, -313,
|
||||
|
@ -966,9 +966,9 @@ namespace System
|
|||
284, 284, 284, 285, 285, 285, 286, 286, 286, 286, 287, 287,
|
||||
287, 288, 288, 288, 289, 289, 289, 289, 290, 290, 290, 291,
|
||||
291, 291, 292, 292, 292, 293, 293, 293 );
|
||||
private static char8[16] DigitLowerTable = .('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
|
||||
private static char8[16] DigitUpperTable = .('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
|
||||
private static int64[19] TenPowersList = .(
|
||||
private const char8[16] DigitLowerTable = .('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
|
||||
private const char8[16] DigitUpperTable = .('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
|
||||
private const int64[19] TenPowersList = .(
|
||||
1L,
|
||||
10L,
|
||||
100L,
|
||||
|
@ -991,7 +991,7 @@ namespace System
|
|||
|
||||
// DecHexDigits s a translation table from a decimal number to its
|
||||
// digits hexadecimal representation (e.g. DecHexDigits [34] = 0x34).
|
||||
private static int32[100] DecHexDigits = .(
|
||||
private const int32[100] DecHexDigits = .(
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
|
||||
|
@ -1235,8 +1235,10 @@ namespace System
|
|||
// _isCustomFormat, _specifierIsUpper, _specifier & _precision.
|
||||
this(CultureInfo cultureInfo)
|
||||
{
|
||||
//_cbuf = EmptyArray<char>.Value;
|
||||
_cbuf = sEmtpyBuf;
|
||||
if (Compiler.IsConstEval)
|
||||
_cbuf = new char8[0];
|
||||
else
|
||||
_cbuf = sEmtpyBuf;
|
||||
if (cultureInfo != null)
|
||||
CurrentCulture = cultureInfo;
|
||||
}
|
||||
|
@ -2032,13 +2034,12 @@ namespace System
|
|||
private void FormatHexadecimal (int32 precision, String outString)
|
||||
{
|
||||
int32 size = Math.Max (precision, _decPointPos);
|
||||
char8* digits = _specifierIsUpper ? &DigitUpperTable : &DigitLowerTable;
|
||||
|
||||
|
||||
ResetCharBuf (size);
|
||||
_ind = size;
|
||||
uint64 val = _val1 | ((uint64)_val2 << 32);
|
||||
while (size > 0) {
|
||||
_cbuf [--size] = digits [val & 0xf];
|
||||
_cbuf [--size] = _specifierIsUpper ? DigitUpperTable[val & 0xf] : DigitLowerTable[val & 0xf];
|
||||
val >>= 4;
|
||||
}
|
||||
outString.Append(_cbuf, 0, _ind);
|
||||
|
@ -2046,8 +2047,6 @@ namespace System
|
|||
|
||||
private void FormatAddress(String outString)
|
||||
{
|
||||
char8* digits = _specifierIsUpper ? &DigitUpperTable : &DigitLowerTable;
|
||||
|
||||
const int bufLen = 18;
|
||||
char8* strChars = scope:: char8[bufLen]* (?);
|
||||
int32 curLen = 0;
|
||||
|
@ -2056,7 +2055,7 @@ namespace System
|
|||
{
|
||||
if (curLen == 8)
|
||||
strChars[bufLen - curLen++ - 1] = '\'';
|
||||
strChars[bufLen - curLen++ - 1] = digits[(int)(valLeft & 0xF)];
|
||||
strChars[bufLen - curLen++ - 1] = _specifierIsUpper ? DigitUpperTable[(int)(valLeft & 0xF)] : DigitLowerTable[(int)(valLeft & 0xF)];
|
||||
valLeft >>= 4;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue