0003-Fix-64-bit-shifting-in-dynahash.c.patch

text/plain

Filename: 0003-Fix-64-bit-shifting-in-dynahash.c.patch
Type: text/plain
Part: 2
Message: some extra warnings from MSVC

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch 0003
Subject: Fix 64-bit shifting in dynahash.c
File+
src/backend/utils/hash/dynahash.c 1 1
From c57160dd0d6cc4bc0ebcac3b58b89428c090da6c Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Sat, 11 Apr 2026 12:23:23 +0200
Subject: [PATCH 3/3] Fix 64-bit shifting in dynahash.c

The switch from long to int64 in commit 13b935cd521 was incomplete.
It was shifting the constant 1L, which is not always 64 bit.  Fix by
using an explicit int64 constant.

MSVC warning:

../src/backend/utils/hash/dynahash.c(1767): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
---
 src/backend/utils/hash/dynahash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 20610f96e7b..4596e5c7476 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -1764,7 +1764,7 @@ static int64
 next_pow2_int64(int64 num)
 {
 	/* my_log2's internal range check is sufficient */
-	return 1L << my_log2(num);
+	return (int64) 1 << my_log2(num);
 }
 
 /* calculate first power of 2 >= num, bounded to what will fit in an int */
-- 
2.53.0