mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Define sort key length for DECFLOATs in their own module, as this is an implementation detail.
This commit is contained in:
parent
297e7b05d9
commit
6f2ebfd1b7
@ -224,7 +224,7 @@ void make(ULONG* key,
|
||||
*key++ = exp;
|
||||
|
||||
// convert to SLONG
|
||||
fb_assert(pMax / 9 < decSize / sizeof(int));
|
||||
fb_assert(pMax / 9 < decSize / sizeof(ULONG));
|
||||
memset(key, 0, decSize);
|
||||
|
||||
for (unsigned i = 0; i < pMax; ++i)
|
||||
@ -274,7 +274,7 @@ void grab(ULONG* key,
|
||||
}
|
||||
|
||||
// normal value
|
||||
// here we ignore differnces in class for SUBNORMAL, ZERO and NEG
|
||||
// here we ignore differences in class for SUBNORMAL, ZERO and NEG
|
||||
cl = DEC_CLASS_POS_NORMAL;
|
||||
|
||||
// parse exp
|
||||
@ -1054,11 +1054,6 @@ void Decimal128::grabKey(ULONG* key)
|
||||
}
|
||||
}
|
||||
|
||||
ULONG Decimal128::getIndexKeyLength()
|
||||
{
|
||||
return 17;
|
||||
}
|
||||
|
||||
ULONG Decimal128::makeIndexKey(vary* buf)
|
||||
{
|
||||
unsigned char coeff[DECQUAD_Pmax + 2];
|
||||
|
@ -172,6 +172,11 @@ public:
|
||||
bool isNan() const;
|
||||
int sign() const;
|
||||
|
||||
static ULONG getKeyLength()
|
||||
{
|
||||
return sizeof(Decimal64) + sizeof(ULONG);
|
||||
}
|
||||
|
||||
void makeKey(ULONG* key) const;
|
||||
void grabKey(ULONG* key);
|
||||
|
||||
@ -243,9 +248,19 @@ public:
|
||||
bool isNan() const;
|
||||
int sign() const;
|
||||
|
||||
static ULONG getKeyLength()
|
||||
{
|
||||
return sizeof(Decimal128) + sizeof(ULONG);
|
||||
}
|
||||
|
||||
void makeKey(ULONG* key) const;
|
||||
void grabKey(ULONG* key);
|
||||
static ULONG getIndexKeyLength();
|
||||
|
||||
static ULONG getIndexKeyLength()
|
||||
{
|
||||
return 17;
|
||||
}
|
||||
|
||||
ULONG makeIndexKey(vary* buf);
|
||||
|
||||
Decimal128 modf(DecimalStatus decSt, Decimal128* ipart) const;
|
||||
@ -290,6 +305,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(Decimal64) % sizeof(ULONG) == 0);
|
||||
static_assert(sizeof(Decimal128) % sizeof(ULONG) == 0);
|
||||
|
||||
static const size_t MAX_DEC_LONGS = MAX(sizeof(Decimal64), sizeof(Decimal128)) >> SHIFTLONG;
|
||||
static const size_t MAX_DEC_KEY_LONGS = MAX_DEC_LONGS + 1; // key is one longword bigger
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define JRD_SORT_H
|
||||
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../common/DecFloat.h"
|
||||
#include "../jrd/TempSpace.h"
|
||||
|
||||
namespace Jrd {
|
||||
@ -169,16 +170,22 @@ public:
|
||||
|
||||
USHORT getSkdLength() const { return skd_length; }
|
||||
|
||||
void setSkdLength(UCHAR dtype, USHORT v)
|
||||
void setSkdLength(UCHAR dtype, USHORT dscLength)
|
||||
{
|
||||
skd_dtype = dtype;
|
||||
skd_length = v;
|
||||
|
||||
switch (dtype)
|
||||
{
|
||||
case SKD_dec64:
|
||||
case SKD_dec128:
|
||||
skd_length += sizeof(SLONG);
|
||||
fb_assert(dscLength == sizeof(Firebird::Decimal64));
|
||||
skd_length = Firebird::Decimal64::getKeyLength();
|
||||
break;
|
||||
case SKD_dec128:
|
||||
fb_assert(dscLength == sizeof(Firebird::Decimal128));
|
||||
skd_length = Firebird::Decimal128::getKeyLength();
|
||||
break;
|
||||
default:
|
||||
skd_length = dscLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user