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

◆ SearchScale()

static int System.Decimal.DecCalc.SearchScale ( ref Buf12 bufQuo,
int scale )
inlinestaticprivate

Definition at line 635 of file Decimal.cs.

636 {
637 uint u = bufQuo.U2;
638 ulong low = bufQuo.Low64;
639 int num = 0;
640 if (u <= 429496729)
641 {
642 PowerOvfl[] powerOvflValues = PowerOvflValues;
643 if (scale > 19)
644 {
645 num = 28 - scale;
646 if (u < powerOvflValues[num - 1].Hi)
647 {
648 goto IL_00d1;
649 }
650 }
651 else if (u < 4 || (u == 4 && low <= 5441186219426131129L))
652 {
653 return 9;
654 }
655 if (u > 42949)
656 {
657 if (u > 4294967)
658 {
659 num = 2;
660 if (u > 42949672)
661 {
662 num--;
663 }
664 }
665 else
666 {
667 num = 4;
668 if (u > 429496)
669 {
670 num--;
671 }
672 }
673 }
674 else if (u > 429)
675 {
676 num = 6;
677 if (u > 4294)
678 {
679 num--;
680 }
681 }
682 else
683 {
684 num = 8;
685 if (u > 42)
686 {
687 num--;
688 }
689 }
690 if (u == powerOvflValues[num - 1].Hi && low > powerOvflValues[num - 1].MidLo)
691 {
692 num--;
693 }
694 }
695 goto IL_00d1;
696 IL_00d1:
697 if (num + scale < 0)
698 {
699 Number.ThrowOverflowException(TypeCode.Decimal);
700 }
701 return num;
702 }
static readonly PowerOvfl[] PowerOvflValues
Definition Decimal.cs:226

References System.Runtime.Serialization.Dictionary, System.L, System.Decimal.DecCalc.PowerOvflValues, and System.Number.ThrowOverflowException().

Referenced by System.Decimal.DecCalc.VarDecDiv(), and System.Decimal.DecCalc.VarDecMod().