Example #1
0
        /// <inheritdoc cref="MulDiv(long, long, long, out long)"/>
        public static long MulDiv(long a, long mulBy, long divBy)
        {
            long  mH, remainder;
            ulong mL = Math128.Multiply(a, mulBy, out mH);

            return(Math128.Divide(mH, mL, divBy, out remainder, false));
        }
Example #2
0
        /// <inheritdoc cref="MulDiv(ulong, ulong, ulong, out ulong)"/>
        public static ulong MulDiv(ulong a, ulong mulBy, ulong divBy)
        {
            ulong mH, remainder;
            ulong mL = Math128.Multiply(a, mulBy, out mH);

            return(Math128.Divide(mH, mL, divBy, out remainder));
        }
Example #3
0
        /// <inheritdoc cref="MulShift(int,int,int)"/>
        public static ulong MulShift(ulong a, ulong mulBy, int shiftBy)
        {
            ulong rH;
            ulong rL = Math128.Multiply(a, mulBy, out rH);

            Math128.ShiftRight(rH, ref rL, shiftBy);
            return(rL);
        }