summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/utils/memutils_internal.h5
-rw-r--r--src/include/utils/memutils_memorychunk.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/include/utils/memutils_internal.h b/src/include/utils/memutils_internal.h
index 9a9f52ef164..377cee7a841 100644
--- a/src/include/utils/memutils_internal.h
+++ b/src/include/utils/memutils_internal.h
@@ -74,6 +74,9 @@ extern void SlabCheck(MemoryContext context);
* MemoryContextMethodID
* A unique identifier for each MemoryContext implementation which
* indicates the index into the mcxt_methods[] array. See mcxt.c.
+ * The maximum value for this enum is constrained by
+ * MEMORY_CONTEXT_METHODID_MASK. If an enum value higher than that is
+ * required then MEMORY_CONTEXT_METHODID_BITS will need to be increased.
*/
typedef enum MemoryContextMethodID
{
@@ -88,7 +91,7 @@ typedef enum MemoryContextMethodID
*/
#define MEMORY_CONTEXT_METHODID_BITS 3
#define MEMORY_CONTEXT_METHODID_MASK \
- UINT64CONST((1 << MEMORY_CONTEXT_METHODID_BITS) - 1)
+ ((((uint64) 1) << MEMORY_CONTEXT_METHODID_BITS) - 1)
/*
* This routine handles the context-type-independent part of memory
diff --git a/src/include/utils/memutils_memorychunk.h b/src/include/utils/memutils_memorychunk.h
index 685c177b681..2eefc138e3e 100644
--- a/src/include/utils/memutils_memorychunk.h
+++ b/src/include/utils/memutils_memorychunk.h
@@ -159,7 +159,7 @@ MemoryChunkSetHdrMask(MemoryChunk *chunk, void *block,
Assert((char *) chunk > (char *) block);
Assert(blockoffset <= MEMORYCHUNK_MAX_BLOCKOFFSET);
Assert(value <= MEMORYCHUNK_MAX_VALUE);
- Assert(methodid <= MEMORY_CONTEXT_METHODID_MASK);
+ Assert((int) methodid <= MEMORY_CONTEXT_METHODID_MASK);
chunk->hdrmask = (((uint64) blockoffset) << MEMORYCHUNK_BLOCKOFFSET_BASEBIT) |
(((uint64) value) << MEMORYCHUNK_VALUE_BASEBIT) |
@@ -175,7 +175,7 @@ static inline void
MemoryChunkSetHdrMaskExternal(MemoryChunk *chunk,
MemoryContextMethodID methodid)
{
- Assert(methodid <= MEMORY_CONTEXT_METHODID_MASK);
+ Assert((int) methodid <= MEMORY_CONTEXT_METHODID_MASK);
chunk->hdrmask = MEMORYCHUNK_MAGIC | (((uint64) 1) << MEMORYCHUNK_EXTERNAL_BASEBIT) |
methodid;