private void AddULong(uint ulAdd)
{
ulong dwlAccum = ulAdd;
int iData; // which UI4 in this we are on
int iDataMax = _bLen; // # of UI4s in this
uint[] rguiData = new uint[4] { _data1, _data2, _data3, _data4 };
// Add, starting at the LS UI4 until out of UI4s or no carry
iData = 0;
do
{
dwlAccum += rguiData[iData];
rguiData[iData] = (uint)dwlAccum; // equivalent to mod x_dwlBaseUI4
dwlAccum >>= 32; // equivalent to dwlAccum /= x_dwlBaseUI4;
if (0 == dwlAccum)
{
StoreFromWorkingArray(rguiData);
return;
}
iData++;
}
while (iData < iDataMax);
// There is carry at the end
Debug.Assert(dwlAccum < s_ulInt32Base, "dwlAccum < x_lInt32Base", "");
// Either overflowed
if (iData == s_cNumeMax)
throw new OverflowException(SQLResource.s_arithOverflowMessage);
// Or need to extend length by 1 UI4
rguiData[iData] = (uint)dwlAccum;
_bLen++;
if (FGt10_38(rguiData))
throw new OverflowException(SQLResource.s_arithOverflowMessage);
StoreFromWorkingArray(rguiData);
}