v1-0002-Adjust-MemSet-macro-to-use-Size-rather-than-long.patch
application/octet-stream
Filename: v1-0002-Adjust-MemSet-macro-to-use-Size-rather-than-long.patch
Type: application/octet-stream
Part: 1
From fe423b15ed05af930103e0b6f89a81285d1e28c0 Mon Sep 17 00:00:00 2001
From: David Rowley <dgrowley@gmail.com>
Date: Thu, 6 Nov 2025 23:29:27 +1300
Subject: [PATCH v1 2/2] Adjust MemSet macro to use Size rather than long
Likewise for MemSetAligned.
---
src/include/c.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/include/c.h b/src/include/c.h
index 757dfff4782..e9dbc18a532 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1007,8 +1007,8 @@ pg_noreturn extern void ExceptionalCondition(const char *conditionName,
#define Min(x, y) ((x) < (y) ? (x) : (y))
-/* Get a bit mask of the bits set in non-long aligned addresses */
-#define LONG_ALIGN_MASK (sizeof(long) - 1)
+/* Get a bit mask of the bits set in non-Size aligned addresses */
+#define SIZE_ALIGN_MASK (sizeof(Size) - 1)
/*
* MemSet
@@ -1028,8 +1028,8 @@ pg_noreturn extern void ExceptionalCondition(const char *conditionName,
int _val = (val); \
Size _len = (len); \
\
- if ((((uintptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
- (_len & LONG_ALIGN_MASK) == 0 && \
+ if ((((uintptr_t) _vstart) & SIZE_ALIGN_MASK) == 0 && \
+ (_len & SIZE_ALIGN_MASK) == 0 && \
_val == 0 && \
_len <= MEMSET_LOOP_LIMIT && \
/* \
@@ -1038,8 +1038,8 @@ pg_noreturn extern void ExceptionalCondition(const char *conditionName,
*/ \
MEMSET_LOOP_LIMIT != 0) \
{ \
- long *_start = (long *) _vstart; \
- long *_stop = (long *) ((char *) _start + _len); \
+ Size *_start = (Size *) _vstart; \
+ Size *_stop = (Size *) ((char *) _start + _len); \
while (_start < _stop) \
*_start++ = 0; \
} \
@@ -1056,16 +1056,16 @@ pg_noreturn extern void ExceptionalCondition(const char *conditionName,
#define MemSetAligned(start, val, len) \
do \
{ \
- long *_start = (long *) (start); \
+ Size *_start = (Size *) (start); \
int _val = (val); \
Size _len = (len); \
\
- if ((_len & LONG_ALIGN_MASK) == 0 && \
+ if ((_len & SIZE_ALIGN_MASK) == 0 && \
_val == 0 && \
_len <= MEMSET_LOOP_LIMIT && \
MEMSET_LOOP_LIMIT != 0) \
{ \
- long *_stop = (long *) ((char *) _start + _len); \
+ Size *_stop = (Size *) ((char *) _start + _len); \
while (_start < _stop) \
*_start++ = 0; \
} \
--
2.43.0