示例#1
0
        public static Int64 operator *(Int64 x, int y)
        {
            UInt32 hi  = (y < 0) ? UInt32.MaxValue : 0;
            UInt64 res = UInt64.Multiply(x.lo, (uint)x.hi, (UInt32)y, hi);

            return(new Int64(res));
        }
示例#2
0
        public static Int64 operator *(Int64 x, Int64 y)
        {
            bool sign1 = x.m_hi < 0;
            bool sign2 = y.m_hi < 0;

            if (sign1)
            {
                x = -x;
            }
            if (sign2)
            {
                y = -y;
            }

            UInt64 u      = UInt64.Multiply(x.m_lo, (uint)x.m_hi, y.m_lo, (uint)y.m_hi);
            Int64  result = new Int64(u);

            if (sign1 != sign2)
            {
                return(-result);
            }
            return(result);
        }
示例#3
0
        public static Int64 operator *(Int64 d1, Int64 d2)
        {
            bool sign1 = d1.hi < 0;
            bool sign2 = d2.hi < 0;

            if (sign1)
            {
                d1.Negate();
            }
            if (sign2)
            {
                d2.Negate();
            }

            UInt64 u      = UInt64.Multiply(d1.lo, (uint)d1.hi, d2.lo, (uint)d2.hi);
            Int64  result = new Int64(u);

            if (sign1 != sign2)
            {
                result.Negate();
            }
            return(result);
        }
示例#4
0
 public static UInt64 Add(this UInt64 d, Percentage p)
 {
     return(d + d.Multiply(p));
 }
示例#5
0
 public static UInt64 Subtract(this UInt64 d, Percentage p)
 {
     return(d - d.Multiply(p));
 }