mirror of
https://github.com/postgres/postgres.git
synced 2026-05-28 04:35:45 -04:00
Fix unportable use of __builtin_constant_p
On MSVC Arm, USE_ARMV8_CRC32C is defined, but __builtin_constant_p
is not available. Use pg_integer_constant_p and add appropriate
guards. There is a similar potential hazard for the x86 path, but
for now let's get the buildfarm green.
Oversight in commit fbc57f2bc, per buildfarm member hoatzin.
This commit is contained in:
parent
07009121c2
commit
8194c4a9dd
1 changed files with 9 additions and 1 deletions
|
|
@ -113,13 +113,21 @@ extern pg_crc32c pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t l
|
|||
#elif defined(USE_ARMV8_CRC32C)
|
||||
/*
|
||||
* Use either ARMv8 CRC Extension or CRYPTO Extension (PMULL) instructions.
|
||||
*/
|
||||
#ifdef HAVE_PG_INTEGER_CONSTANT_P
|
||||
/*
|
||||
* We don't need a runtime check for CRC, so for constant inputs, where
|
||||
* we assume the input is small, we can avoid an indirect function call.
|
||||
*/
|
||||
#define COMP_CRC32C(crc, data, len) \
|
||||
((crc) = __builtin_constant_p(len) ? \
|
||||
((crc) = pg_integer_constant_p(len) ? \
|
||||
pg_comp_crc32c_armv8((crc), (data), (len)) : \
|
||||
pg_comp_crc32c((crc), (data), (len)))
|
||||
#else
|
||||
#define COMP_CRC32C(crc, data, len) \
|
||||
((crc) = pg_comp_crc32c((crc), (data), (len)))
|
||||
#endif /* HAVE_PG_INTEGER_CONSTANT_P */
|
||||
|
||||
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
|
||||
|
||||
extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
|
||||
|
|
|
|||
Loading…
Reference in a new issue