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)); }
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); }
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); }
public static UInt64 Add(this UInt64 d, Percentage p) { return(d + d.Multiply(p)); }
public static UInt64 Subtract(this UInt64 d, Percentage p) { return(d - d.Multiply(p)); }