private int LAbsCmp(SqlDecimal snumOp)
{
int iData; //which UI4 we are operating on
int culOp; //#of UI4s on operand
int culThis; //# of UI4s in this
// If one longer, it is larger
culOp = snumOp._bLen;
culThis = _bLen;
if (culOp != culThis)
return (culThis > culOp) ? 1 : -1;
uint[] rglData1 = new uint[4] { _data1, _data2, _data3, _data4 };
uint[] rglData2 = new uint[4] { snumOp._data1, snumOp._data2, snumOp._data3, snumOp._data4 };
// Loop through numeric value checking each byte for differences.
iData = culOp - 1;
do
{
// CONSIDER PERF: Could replace second comparison with
// cast to LONGLONG and subtract. Probably not worth it.
if (rglData1[iData] != rglData2[iData])
return ((rglData1[iData] > rglData2[iData]) ? 1 : -1);
iData--;
}
while (iData >= 0);
// All UI4s the same, return 0.
return 0;
}