avamingli commented on code in PR #1390:
URL: https://github.com/apache/cloudberry/pull/1390#discussion_r2428375400
##########
src/include/postgres.h:
##########
@@ -238,58 +236,22 @@ typedef struct
/* VARSIZE_4B() should only be used on known-aligned data */
#define VARSIZE_4B(PTR) \
- (((varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF)
+ (ntohl(((varattrib_4b *) (PTR))->va_4byte.va_header) & 0x3FFFFFFF)
#define VARSIZE_1B(PTR) \
(((varattrib_1b *) (PTR))->va_header & 0x7F)
#define VARTAG_1B_E(PTR) \
(((varattrib_1b_e *) (PTR))->va_tag)
#define SET_VARSIZE_4B(PTR,len) \
- (((varattrib_4b *) (PTR))->va_4byte.va_header = (len) & 0x3FFFFFFF)
+ (((varattrib_4b *) (PTR))->va_4byte.va_header = htonl( (len) &
0x3FFFFFFF ))
#define SET_VARSIZE_4B_C(PTR,len) \
- (((varattrib_4b *) (PTR))->va_4byte.va_header = ((len) & 0x3FFFFFFF) |
0x40000000)
+ (((varattrib_4b *) (PTR))->va_4byte.va_header = htonl( ((len) &
0x3FFFFFFF) | 0x40000000 ))
#define SET_VARSIZE_1B(PTR,len) \
(((varattrib_1b *) (PTR))->va_header = (len) | 0x80)
#define SET_VARTAG_1B_E(PTR,tag) \
(((varattrib_1b_e *) (PTR))->va_header = 0x80, \
((varattrib_1b_e *) (PTR))->va_tag = (tag))
-#define VARSIZE_TO_SHORT(PTR) ((char)(VARSIZE(PTR)-VARHDRSZ+VARHDRSZ_SHORT)
| 0x80)
-
-#else /* !WORDS_BIGENDIAN */
-
-#define VARATT_IS_4B(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)
Review Comment:
We typically use the #if 0 MACRO with comments to disable code, preserve the
original PostgreSQL logic, and prevent potential conflicts during kernel
upgrades.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]