System.Data.SqlTypes.SqlDecimal.BActualPrec C# (CSharp) Method

BActualPrec() private method

private BActualPrec ( ) : byte
return byte
        private byte BActualPrec()
        {
            if (_bPrec == 0 || _bLen < 1)
                return 0;

            int ciulU = _bLen;
            int Prec;
            uint ulRem;

            if (ciulU == 1)
            {
                Prec = BGetPrecUI4(_data1);
            }
            else if (ciulU == 2)
            {
                Prec = BGetPrecUI8(_data1, _data2);
            }
            else
            {
                uint[] rgulU = new uint[4] { _data1, _data2, _data3, _data4 };
                Prec = 0;
                do
                {
                    MpDiv1(rgulU, ref ciulU, 1000000000, out ulRem);
                    Prec += 9;
                }
                while (ciulU > 2);
                Debug.Assert(Prec == 9 || Prec == 18 || Prec == 27);
                Prec += BGetPrecUI8(rgulU[0], rgulU[1]);
            }

            // If number of significant digits less than scale, return scale
            return (Prec < _bScale ? _bScale : (byte)Prec);
        }
#endif