@@ -15,7 +15,7 @@ internal unsafe ref struct BigInteger
1515 {
1616 private const int MaxBlockCount = 35 ;
1717
18- private static readonly uint [ ] Pow10UInt32Table = new uint [ ]
18+ private static readonly uint [ ] s_Pow10UInt32Table = new uint [ ]
1919 {
2020 1 , // 10^0
2121 10 , // 10^1
@@ -27,7 +27,7 @@ internal unsafe ref struct BigInteger
2727 10000000 , // 10^7
2828 } ;
2929
30- private static readonly int [ ] Pow10BigNumTableIndices = new int [ ]
30+ private static readonly int [ ] s_s_Pow10BigNumTableIndices = new int [ ]
3131 {
3232 0 , // 10^8
3333 2 , // 10^16
@@ -37,7 +37,7 @@ internal unsafe ref struct BigInteger
3737 33 , // 10^256
3838 } ;
3939
40- private static readonly uint [ ] Pow10BigNumTable = new uint [ ]
40+ private static readonly uint [ ] s_Pow10BigNumTable = new uint [ ]
4141 {
4242 // 10^8
4343 1 , // _length
@@ -123,7 +123,7 @@ internal unsafe ref struct BigInteger
123123 0x00000000 ,
124124 } ;
125125
126- private static readonly uint [ ] MultiplyDeBruijnBitPosition = new uint [ ]
126+ private static readonly uint [ ] s_MultiplyDeBruijnBitPosition = new uint [ ]
127127 {
128128 0 , 9 , 1 , 10 , 13 , 21 , 2 , 29 , 11 , 14 , 16 , 18 , 22 , 25 , 3 , 30 ,
129129 8 , 12 , 20 , 28 , 15 , 17 , 24 , 7 , 19 , 27 , 23 , 6 , 26 , 5 , 4 , 31
@@ -161,7 +161,7 @@ public static uint BitScanReverse(uint mask)
161161 mask |= ( mask >> 16 ) ;
162162
163163 uint index = ( mask * 0x07C4ACDD ) >> 27 ;
164- return MultiplyDeBruijnBitPosition [ ( int ) ( index ) ] ;
164+ return s_MultiplyDeBruijnBitPosition [ ( int ) ( index ) ] ;
165165 }
166166
167167 public static int Compare ( ref BigInteger lhs , ref BigInteger rhs )
@@ -367,7 +367,7 @@ public static void Multiply(ref BigInteger lhs, ref BigInteger rhs, ref BigInteg
367367 Debug . Assert ( unchecked ( ( uint ) ( maxResultLength ) ) <= MaxBlockCount ) ;
368368
369369 // Zero out result internal blocks.
370- Buffer . ZeroMemory ( ( byte * ) ( result . _blocks . GetPointer ( ) ) , ( MaxBlockCount * sizeof ( uint ) ) ) ;
370+ Buffer . ZeroMemory ( ( byte * ) ( result . _blocks . GetPointer ( ) ) , ( maxResultLength * sizeof ( uint ) ) ) ;
371371
372372 int smallIndex = 0 ;
373373 int resultStartIndex = 0 ;
@@ -412,33 +412,33 @@ public static void Multiply(ref BigInteger lhs, ref BigInteger rhs, ref BigInteg
412412
413413 public static void Pow10 ( uint exponent , ref BigInteger result )
414414 {
415- // We leverage two arrays - Pow10UInt32Table and Pow10BigNumTable to speed up the Pow10 calculation.
415+ // We leverage two arrays - s_Pow10UInt32Table and s_Pow10BigNumTable to speed up the Pow10 calculation.
416416 //
417- // Pow10UInt32Table stores the results of 10^0 to 10^7.
418- // Pow10BigNumTable stores the results of 10^8, 10^16, 10^32, 10^64, 10^128 and 10^256.
417+ // s_Pow10UInt32Table stores the results of 10^0 to 10^7.
418+ // s_Pow10BigNumTable stores the results of 10^8, 10^16, 10^32, 10^64, 10^128 and 10^256.
419419 //
420420 // For example, let's say exp = 0b111111. We can split the exp to two parts, one is small exp,
421421 // which 10^smallExp can be represented as uint, another part is 10^bigExp, which must be represented as BigNum.
422422 // So the result should be 10^smallExp * 10^bigExp.
423423 //
424- // Calculating 10^smallExp is simple, we just lookup the 10^smallExp from Pow10UInt32Table .
424+ // Calculating 10^smallExp is simple, we just lookup the 10^smallExp from s_Pow10UInt32Table .
425425 // But here's a bad news: although uint can represent 10^9, exp 9's binary representation is 1001.
426426 // That means 10^(1011), 10^(1101), 10^(1111) all cannot be stored as uint, we cannot easily say something like:
427- // "Any bits <= 3 is small exp, any bits > 3 is big exp". So instead of involving 10^8, 10^9 to Pow10UInt32Table ,
428- // consider 10^8 and 10^9 as a bigNum, so they fall into Pow10BigNumTable . Now we can have a simple rule:
427+ // "Any bits <= 3 is small exp, any bits > 3 is big exp". So instead of involving 10^8, 10^9 to s_Pow10UInt32Table ,
428+ // consider 10^8 and 10^9 as a bigNum, so they fall into s_Pow10BigNumTable . Now we can have a simple rule:
429429 // "Any bits <= 3 is small exp, any bits > 3 is big exp".
430430 //
431431 // For 0b111111, we first calculate 10^(smallExp), which is 10^(7), now we can shift right 3 bits, prepare to calculate the bigExp part,
432432 // the exp now becomes 0b000111.
433433 //
434- // Apparently the lowest bit of bigExp should represent 10^8 because we have already shifted 3 bits for smallExp, so Pow10BigNumTable [0] = 10^8.
434+ // Apparently the lowest bit of bigExp should represent 10^8 because we have already shifted 3 bits for smallExp, so s_Pow10BigNumTable [0] = 10^8.
435435 // Now let's shift exp right 1 bit, the lowest bit should represent 10^(8 * 2) = 10^16, and so on...
436436 //
437- // That's why we just need the values of Pow10BigNumTable be power of 2.
437+ // That's why we just need the values of s_Pow10BigNumTable be power of 2.
438438 //
439439 // More details of this implementation can be found at: https://github.com/dotnet/coreclr/pull/12894#discussion_r128890596
440440
441- BigInteger temp1 = new BigInteger ( Pow10UInt32Table [ exponent & 0x7 ] ) ;
441+ BigInteger temp1 = new BigInteger ( s_Pow10UInt32Table [ exponent & 0x7 ] ) ;
442442 ref BigInteger lhs = ref temp1 ;
443443
444444 BigInteger temp2 = new BigInteger ( 0 ) ;
@@ -453,7 +453,7 @@ public static void Pow10(uint exponent, ref BigInteger result)
453453 if ( ( exponent & 1 ) != 0 )
454454 {
455455 // Multiply into the next temporary
456- ref BigInteger rhs = ref * ( BigInteger * ) ( Unsafe . AsPointer ( ref Pow10BigNumTable [ Pow10BigNumTableIndices [ index ] ] ) ) ;
456+ ref BigInteger rhs = ref * ( BigInteger * ) ( Unsafe . AsPointer ( ref s_Pow10BigNumTable [ s_s_Pow10BigNumTableIndices [ index ] ] ) ) ;
457457 Multiply( ref lhs , ref rhs , ref product ) ;
458458
459459 // Swap to the next temporary
0 commit comments