Lines Matching refs:remainder
1379 // remainder, which is the gcd(*this,modulo) as calculated by the Euclidean
1608 // D5. [Test remainder.] Set q[j] = qp. If the result of step D4 was
1639 // remainder may be obtained by dividing u[...] by d. If r is non-null we
1640 // compute the remainder (urem uses this).
1647 DEBUG(dbgs() << "KnuthDiv: remainder:");
1668 APInt *Quotient, APInt *Remainder)
1690 if ((Remainder?4:3)*n+2*m+1 <= 128) {
1694 if (Remainder)
1700 if (Remainder)
1721 // initialize the quotient and remainder
1723 if (Remainder)
1746 unsigned remainder = 0;
1748 uint64_t partial_dividend = uint64_t(remainder) << 32 | U[i];
1751 remainder = 0;
1754 remainder = (unsigned)partial_dividend;
1757 remainder = 0;
1760 remainder = (unsigned)(partial_dividend - (Q[i] * divisor));
1764 R[0] = remainder;
1802 // If the caller wants the remainder
1803 if (Remainder) {
1804 // Set up the Remainder value's memory.
1805 if (Remainder->BitWidth != RHS.BitWidth) {
1806 if (Remainder->isSingleWord())
1807 Remainder->VAL = 0;
1809 delete [] Remainder->pVal;
1810 Remainder->BitWidth = RHS.BitWidth;
1811 if (!Remainder->isSingleWord())
1812 Remainder->pVal = getClearedMemory(Remainder->getNumWords());
1814 Remainder->clearAllBits();
1816 // The remainder is in R. Reconstitute the remainder into Remainder's low
1821 if (Remainder->isSingleWord())
1822 Remainder->VAL = tmp;
1824 Remainder->pVal[0] = tmp;
1826 assert(!Remainder->isSingleWord() && "Remainder APInt not large enough");
1828 Remainder->pVal[i] =
1893 assert(RHS.VAL != 0 && "Remainder by zero?");
1904 assert(rhsWords && "Performing remainder operation by zero ???");
1917 // All high words are zero, just use native remainder
1922 APInt Remainder(1,0);
1923 divide(*this, lhsWords, RHS, rhsWords, 0, &Remainder);
1924 return Remainder;
1939 APInt &Quotient, APInt &Remainder) {
1949 Remainder = 0; // 0 % Y ===> 0
1954 Remainder = LHS; // X % Y ===> X, iff X < Y
1961 Remainder = 0; // X % X ===> 0;
1970 Remainder = APInt(LHS.getBitWidth(), lhsValue % rhsValue);
1975 divide(LHS, lhsWords, RHS, rhsWords, &Quotient, &Remainder);
1979 APInt &Quotient, APInt &Remainder) {
1982 APInt::udivrem(-LHS, -RHS, Quotient, Remainder);
1984 APInt::udivrem(-LHS, RHS, Quotient, Remainder);
1987 Remainder = -Remainder;
1989 APInt::udivrem(LHS, -RHS, Quotient, Remainder);
1992 APInt::udivrem(LHS, RHS, Quotient, Remainder);
2663 /* If RHS is zero LHS and REMAINDER are left unchanged, return one.
2665 set REMAINDER to the remainder, return zero. i.e.
2667 OLD_LHS = RHS * LHS + REMAINDER
2671 destroyed. LHS, REMAINDER and SCRATCH must be distinct.
2675 integerPart *remainder, integerPart *srhs,
2681 assert(lhs != remainder && lhs != srhs && remainder != srhs);
2693 tcAssign(remainder, lhs, parts);
2696 /* Loop, subtracting SRHS if REMAINDER is greater and adding that to
2701 compare = tcCompare(remainder, srhs, parts);
2703 tcSubtract(remainder, srhs, 0, parts);