Use correct datum macros in more tuplesort specialization functions.
Also clarify that ApplySignedSortComparator() is not built on 32-bit machines. Folow-up to c90c16591 Reviewed-by: David Rowley Discussion: https://www.postgresql.org/message-id/CAFBsxsFmt4_JUP8XgSJqwaAS9a9s8K8_PvMu%3Dj%3DDfwU%3D8QjNPw%40mail.gmail.com
This commit is contained in:
parent
d70b95a717
commit
7761b9faab
@ -262,6 +262,7 @@ ApplyUnsignedSortComparator(Datum datum1, bool isNull1,
|
|||||||
return compare;
|
return compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SIZEOF_DATUM >= 8
|
||||||
static inline int
|
static inline int
|
||||||
ApplySignedSortComparator(Datum datum1, bool isNull1,
|
ApplySignedSortComparator(Datum datum1, bool isNull1,
|
||||||
Datum datum2, bool isNull2,
|
Datum datum2, bool isNull2,
|
||||||
@ -287,19 +288,15 @@ ApplySignedSortComparator(Datum datum1, bool isNull1,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if SIZEOF_DATUM == 8
|
compare = DatumGetInt64(datum1) < DatumGetInt64(datum2) ? -1 :
|
||||||
compare = (int64) datum1 < (int64) datum2 ? -1 :
|
DatumGetInt64(datum1) > DatumGetInt64(datum2) ? 1 : 0;
|
||||||
(int64) datum1 > (int64) datum2 ? 1 : 0;
|
|
||||||
#else
|
|
||||||
compare = (int32) datum1 < (int32) datum2 ? -1 :
|
|
||||||
(int32) datum1 > (int32) datum2 ? 1 : 0;
|
|
||||||
#endif
|
|
||||||
if (ssup->ssup_reverse)
|
if (ssup->ssup_reverse)
|
||||||
INVERT_COMPARE_RESULT(compare);
|
INVERT_COMPARE_RESULT(compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
return compare;
|
return compare;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
ApplyInt32SortComparator(Datum datum1, bool isNull1,
|
ApplyInt32SortComparator(Datum datum1, bool isNull1,
|
||||||
@ -326,8 +323,8 @@ ApplyInt32SortComparator(Datum datum1, bool isNull1,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
compare = (int32) datum1 < (int32) datum2 ? -1 :
|
compare = DatumGetInt32(datum1) < DatumGetInt32(datum2) ? -1 :
|
||||||
(int32) datum1 > (int32) datum2 ? 1 : 0;
|
DatumGetInt32(datum1) > DatumGetInt32(datum2) ? 1 : 0;
|
||||||
if (ssup->ssup_reverse)
|
if (ssup->ssup_reverse)
|
||||||
INVERT_COMPARE_RESULT(compare);
|
INVERT_COMPARE_RESULT(compare);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user