Lines Matching refs:pauElements
69 || ASMMemIsAllU32(&(a_pBigNum)->pauElements[(a_pBigNum)->cUsed], \
123 DECLASM(RTBIGNUMELEMENT) rtBigNumMagnitudeShiftLeftOneAssemblyWorker(RTBIGNUMELEMENT *pauElements, uint32_t cUsed,
216 pDst->pauElements[0] = pValue2x->s.Lo;
217 pDst->pauElements[1] = pValue2x->s.Hi;
224 pDst->pauElements[0] = pValue2x->s.Lo;
309 if (pBigNum->pauElements)
311 int rc = RTMemSaferScramble(pBigNum->pauElements, pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE); AssertRC(rc);
331 if (pBigNum->pauElements)
333 int rc = RTMemSaferUnscramble(pBigNum->pauElements, pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE); AssertRC(rc);
345 * Getter function for pauElements which extends the array to infinity.
354 return pBigNum->pauElements[iElement];
360 * Grows the pauElements array so it can fit at least @a cNewUsed entries.
378 pvNew = RTMemSaferReallocZ(cbOld, pBigNum->pauElements, cbNew);
380 pvNew = RTMemRealloc(pBigNum->pauElements, cbNew);
388 pBigNum->pauElements = (RTBIGNUMELEMENT *)pvNew;
400 * Changes the cUsed member, growing the pauElements array if necessary.
413 RT_BZERO(&pBigNum->pauElements[cNewUsed], (pBigNum->cUsed - cNewUsed) * RTBIGNUM_ELEMENT_SIZE);
416 Assert(ASMMemIsAllU32(&pBigNum->pauElements[pBigNum->cUsed],
443 RT_BZERO(&pBigNum->pauElements[cNewUsed], (pBigNum->cUsed - cNewUsed) * RTBIGNUM_ELEMENT_SIZE);
446 Assert(ASMMemIsAllU32(&pBigNum->pauElements[pBigNum->cUsed],
457 * For ensuring zero padding of pauElements for sub/add with carry assembly
471 || ASMMemIsAllU32(&pBigNum->pauElements[pBigNum->cUsed],
493 RT_BZERO(&pBigNum->pauElements[cOldUsed], (iElement + 1 - cOldUsed) * RTBIGNUM_ELEMENT_SIZE);
530 while (i > 0 && pBigNum->pauElements[i - 1] == 0)
644 pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemSaferAllocZ(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
646 pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemAlloc(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
647 if (RT_UNLIKELY(!pBigNum->pauElements))
659 pBigNum->pauElements[i] = RT_MAKE_U64_FROM_U8(pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7]);
661 pBigNum->pauElements[i] = RT_MAKE_U32_FROM_U8(pb[0], pb[1], pb[2], pb[3]);
686 pBigNum->pauElements[i] = uLast;
696 pBigNum->pauElements[i] = RT_MAKE_U64_FROM_U8(pb[7], pb[6], pb[5], pb[4], pb[3], pb[2], pb[1], pb[0]);
698 pBigNum->pauElements[i] = RT_MAKE_U32_FROM_U8(pb[3], pb[2], pb[1], pb[0]);
723 pBigNum->pauElements[i] = uLast;
728 * If negative, negate it so we get a positive magnitude value in pauElements.
732 pBigNum->pauElements[0] = 0U - pBigNum->pauElements[0];
734 pBigNum->pauElements[i] = 0U - pBigNum->pauElements[i] - 1U;
742 RTBIGNUMELEMENT *puUnused = &pBigNum->pauElements[pBigNum->cUsed];
795 pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemSaferAllocZ(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
797 pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemAlloc(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
798 if (RT_LIKELY(pBigNum->pauElements))
800 memcpy(pBigNum->pauElements, pSrc->pauElements, pBigNum->cUsed * RTBIGNUM_ELEMENT_SIZE);
802 RT_BZERO(&pBigNum->pauElements[pBigNum->cUsed], (pBigNum->cAllocated - pBigNum->cUsed) * RTBIGNUM_ELEMENT_SIZE);
833 if (pBigNum->pauElements)
838 RTMemSaferFree(pBigNum->pauElements, pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
841 RTMemFree(pBigNum->pauElements);
842 pBigNum->pauElements = NULL;
866 RT_BZERO(&pDst->pauElements[pSrc->cUsed], (pDst->cUsed - pSrc->cUsed) * RTBIGNUM_ELEMENT_SIZE);
869 memcpy(pDst->pauElements, pSrc->pauElements, pSrc->cUsed * RTBIGNUM_ELEMENT_SIZE);
877 memcpy(pDst->pauElements, pSrc->pauElements, pSrc->cUsed * RTBIGNUM_ELEMENT_SIZE);
906 RTBIGNUMELEMENT uLast = pBigNum->pauElements[idxLast]; Assert(uLast);
920 RTBIGNUMELEMENT uLast = pBigNum->pauElements[idxLast]; Assert(uLast);
951 RTBIGNUMELEMENT uElement = pBigNum->pauElements[i];
1027 if (pLeft->pauElements[i] != pRight->pauElements[i])
1029 rc = pLeft->pauElements[i] < pRight->pauElements[i] ? -1 : 1;
1164 if (pLeft->pauElements[i] != pRight->pauElements[i])
1166 rc = pLeft->pauElements[i] < pRight->pauElements[i] ? -1 : 1;
1190 memcpy(pDst->pauElements, pSrc->pauElements, pSrc->cUsed * RTBIGNUM_ELEMENT_SIZE);
1222 pResult->pauElements[i] = rtBigNumElementAddWithCarry(rtBigNumGetElement(pAugend, i),
1229 pResult->pauElements[cElements++] = 1;
1278 rtBigNumMagnitudeSubAssemblyWorker(pResult->pauElements, pMinuend->pauElements,
1279 pSubtrahend->pauElements, pMinuend->cUsed);
1284 RTBIGNUMELEMENT uCorrect = rtBigNumElementSubWithBorrow(pMinuend->pauElements[i], rtBigNumGetElement(pSubtrahend, i), &fBorrow);
1285 AssertMsg(pResult->pauElements[i] == uCorrect, ("[%u]=%#x, expected %#x\n", i, pResult->pauElements[i], uCorrect));
1294 pResult->pauElements[i] = rtBigNumElementSubWithBorrow(pMinuend->pauElements[i],
1343 rtBigNumMagnitudeSubThisAssemblyWorker(pMinuendResult->pauElements, pSubtrahend->pauElements, pMinuendResult->cUsed);
1350 pMinuendResult->pauElements[i] = rtBigNumElementSubWithBorrow(pMinuendResult->pauElements[i],
1536 RT_BZERO(pResult->pauElements, pResult->cUsed * RTBIGNUM_ELEMENT_SIZE);
1539 rtBigNumMagnitudeMultiplyAssemblyWorker(pResult->pauElements,
1540 pMultiplier->pauElements, pMultiplier->cUsed,
1541 pMultiplicand->pauElements, pMultiplicand->cUsed);
1545 RTBIGNUMELEMENT uMultiplier = pMultiplier->pauElements[i];
1551 uint64_t u64 = ASMMult2xU32RetU64(pMultiplicand->pauElements[j], uMultiplier);
1555 uLo = ASMMult2xU64Ret2xU64(pMultiplicand->pauElements[j], uMultiplier, &uHi);
1561 pResult->pauElements[k] = rtBigNumElementAddWithCarry(pResult->pauElements[k], uLo, &fCarry);
1563 pResult->pauElements[k] = rtBigNumElementAddWithCarry(pResult->pauElements[k], uHi, &fCarry);
1567 pResult->pauElements[k] = rtBigNumElementAddWithCarry(pResult->pauElements[k], 0, &fCarry);
1633 pBigNum->pauElements[iElement] &= ~RTBIGNUM_ELEMENT_BIT(iBit);
1634 if (iElement + 1 == pBigNum->cUsed && !pBigNum->pauElements[iElement])
1656 pBigNum->pauElements[iElement] |= RTBIGNUM_ELEMENT_BIT(iBit);
1697 return (pBigNum->pauElements[iElement] >> iBit) & 1;
1719 uCarry = rtBigNumMagnitudeShiftLeftOneAssemblyWorker(pBigNum->pauElements, cUsed, uCarry);
1723 RTBIGNUMELEMENT uTmp = pBigNum->pauElements[i];
1724 pBigNum->pauElements[i] = (uTmp << 1) | uCarry;
1733 pBigNum->pauElements[cUsed] = uCarry;
1767 PCRTBIGNUMELEMENT pauSrc = pValue->pauElements;
1768 PRTBIGNUMELEMENT pauDst = pResult->pauElements;
1853 PCRTBIGNUMELEMENT pauSrc = pValue->pauElements;
1854 PRTBIGNUMELEMENT pauDst = pResult->pauElements;
1861 RTBIGNUMELEMENT uPrev = &pauSrc[i] == &pValue->pauElements[pValue->cUsed] ? 0 : pauSrc[i];
2169 RTBIGNUMELEMENT const DivZ = pNormDivisor->pauElements[cDivisor - 1];
2170 RTBIGNUMELEMENT const DivY = pNormDivisor->pauElements[cDivisor - 2];
2177 RTBIGNUMELEMENT uQhat = rtBigNumKnuthD3_EstimateQhat(&NormDividend.pauElements[j + cDivisor], DivZ, DivY);
2182 bool fNegative = rtBigNumKnuthD4_MulSub(&NormDividend.pauElements[j], pNormDivisor->pauElements, cDivisor, uQhat);
2191 rtBigNumKnuthD6_AddBack(&NormDividend.pauElements[j], pNormDivisor->pauElements, cDivisor);
2196 pQuotient->pauElements[j] = uQhat;
2299 if (pDivisor->cUsed == 1 && pDivisor->pauElements[0] == 1)
2317 pQuotient->pauElements[0] = 1;
2332 RTBIGNUMELEMENT uQ = pDividend->pauElements[0] / pDivisor->pauElements[0];
2333 RTBIGNUMELEMENT uR = pDividend->pauElements[0] % pDivisor->pauElements[0];
2339 pQuotient->pauElements[0] = uQ;
2345 pRemainder->pauElements[0] = uR;
2356 rtBigNumElement2xDiv2xBy1x(&uQ, &uR.s.Lo, pDividend->pauElements[1], pDividend->pauElements[0],
2357 pDivisor->pauElements[0]);
2361 rtBigNumElement2xDiv(&uQ, &uR, pDividend->pauElements[1], pDividend->pauElements[0],
2362 pDivisor->pauElements[1], pDivisor->pauElements[0]);
2479 if (pDivisor->cUsed == 1 && pDivisor->pauElements[0] == 1)
2599 pResult->pauElements[0] = 1;
2604 if (pExponent->cUsed == 1 && pExponent->pauElements[0] == 1)
2619 pResult->pauElements[0] = 1;
2725 if (pModulus->cUsed == 1 && pModulus->pauElements[0] == 1)
2736 pResult->pauElements[0] = 1;
2741 if (pExponent->cUsed == 1 && pExponent->pauElements[0] == 1)
2753 pResult->pauElements[0] = 1;