1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Consistently use unsigned arithmetic for alignment calculations.

This avoids an assumption about the signed number representation.  It is
anticipated to have no functional changes on supported configurations;
many two's complement assumptions remain elsewhere.

Per a suggestion from Andres Freund.
This commit is contained in:
Noah Misch
2013-10-20 21:04:52 -04:00
parent 713a9f210d
commit 709170b790
3 changed files with 10 additions and 10 deletions

View File

@@ -314,7 +314,7 @@ hash_any(register const unsigned char *k, register int keylen)
a = b = c = 0x9e3779b9 + len + 3923095;
/* If the source pointer is word-aligned, we use word-wide fetches */
if (((intptr_t) k & UINT32_ALIGN_MASK) == 0)
if (((uintptr_t) k & UINT32_ALIGN_MASK) == 0)
{
/* Code path for aligned source data */
register const uint32 *ka = (const uint32 *) k;