8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 08:03:04 +01:00

Avoid code duplication

This commit is contained in:
AlexPeshkoff 2022-07-19 13:45:21 +03:00
parent 9a790b8dce
commit bcba509170

View File

@ -660,21 +660,7 @@ ULONG Int128::makeIndexKey(vary* buf, int exp)
unsigned char coeff[PMAX + 2];
unsigned char* c = &coeff[PMAX];
if (sign() > 0)
{
for (Int128 v = *this; v.sign(); )
{
int m;
v.divMod(10, &m);
fb_assert(m < 10);
fb_assert(c > coeff);
*--c = m;
}
}
else
{
for (Int128 v = *this; v.sign(); )
for (Int128 v = sign() > 0 ? -*this : *this ; v.sign(); )
{
int m;
v.divMod(10, &m);
@ -683,9 +669,7 @@ ULONG Int128::makeIndexKey(vary* buf, int exp)
fb_assert(c > coeff);
*--c = -m;
}
}
if (c > coeff)
memset(coeff, 0, c - coeff);
return Decimal128::makeBcdKey(buf, coeff, sign() < 0, exp, BIAS, PMAX);