Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DecimalUtilities.cs
Go to the documentation of this file.
2
3internal static class DecimalUtilities
4{
5 public static int GetScale(this decimal value)
6 {
7 Span<int> destination = stackalloc int[4];
8 decimal.GetBits(value, destination);
9 return (byte)(destination[3] >> 16);
10 }
11
12 public static void GetBits(this decimal value, out bool isNegative, out byte scale, out uint low, out uint mid, out uint high)
13 {
14 Span<int> destination = stackalloc int[4];
15 decimal.GetBits(value, destination);
16 low = (uint)destination[0];
17 mid = (uint)destination[1];
18 high = (uint)destination[2];
19 scale = (byte)(destination[3] >> 16);
20 isNegative = (destination[3] & 0x80000000u) != 0;
21 }
22}
static void GetBits(this decimal value, out bool isNegative, out byte scale, out uint low, out uint mid, out uint high)
static int GetScale(this decimal value)