Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ VarCyFromDec()

static long System.Decimal.DecCalc.VarCyFromDec ( ref DecCalc pdecIn)
inlinestaticpackage

Definition at line 996 of file Decimal.cs.

997 {
998 int num = pdecIn.Scale - 4;
999 long num4;
1000 if (num < 0)
1001 {
1002 if (pdecIn.High == 0)
1003 {
1004 uint a = s_powers10[-num];
1005 ulong num2 = UInt32x32To64(a, pdecIn.Mid);
1006 if (num2 <= uint.MaxValue)
1007 {
1008 ulong num3 = UInt32x32To64(a, pdecIn.Low);
1009 num3 += (num2 <<= 32);
1010 if (num3 >= num2)
1011 {
1012 num4 = (long)num3;
1013 goto IL_006d;
1014 }
1015 }
1016 }
1017 }
1018 else
1019 {
1020 if (num != 0)
1021 {
1022 InternalRound(ref pdecIn, (uint)num, MidpointRounding.ToEven);
1023 }
1024 if (pdecIn.High == 0)
1025 {
1026 num4 = (long)pdecIn.Low64;
1027 goto IL_006d;
1028 }
1029 }
1030 goto IL_0093;
1031 IL_0093:
1032 throw new OverflowException(SR.Overflow_Currency);
1033 IL_006d:
1034 if (num4 >= 0 || (num4 == long.MinValue && pdecIn.IsNegative))
1035 {
1036 if (pdecIn.IsNegative)
1037 {
1038 num4 = -num4;
1039 }
1040 return num4;
1041 }
1042 goto IL_0093;
1043 }
static readonly uint[] s_powers10
Definition Decimal.cs:205
static void InternalRound(ref DecCalc d, uint scale, MidpointRounding mode)
Definition Decimal.cs:1930
static ulong UInt32x32To64(uint a, uint b)
Definition Decimal.cs:300
const decimal MinValue
Definition Decimal.cs:2069

References System.Runtime.Serialization.Dictionary, System.Decimal.DecCalc.InternalRound(), System.Decimal.MinValue, System.SR.Overflow_Currency, System.Decimal.DecCalc.s_powers10, and System.Decimal.DecCalc.UInt32x32To64().

Referenced by System.Decimal.ToOACurrency().