diff --git a/src/include/utils/memutils_internal.h b/src/include/utils/memutils_internal.h index 9a9f52ef16..f348282a07 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 { diff --git a/src/include/utils/memutils_memorychunk.h b/src/include/utils/memutils_memorychunk.h index 685c177b68..2eefc138e3 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;