diff --git a/src/include/storage/block.h b/src/include/storage/block.h
index 4c9d3ace8e..587b1153dd 100644
--- a/src/include/storage/block.h
+++ b/src/include/storage/block.h
@@ -115,7 +115,7 @@ typedef BlockIdData *BlockId;	/* block identifier */
 #define BlockIdGetBlockNumber(blockId) \
 ( \
 	AssertMacro(BlockIdIsValid(blockId)), \
-	(BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \
+	(BlockNumber) ((((BlockNumber)(blockId)->bi_hi) << 16) | ((uint16) (blockId)->bi_lo)) \
 )
 
 #endif							/* BLOCK_H */
