gfphoenix78 commented on code in PR #1467:
URL: https://github.com/apache/cloudberry/pull/1467#discussion_r2587683182


##########
contrib/udp2/ic_common/udp2/ic_udp2_internal.hpp:
##########
@@ -63,6 +66,21 @@
 
 namespace {
 
+/*
+ * Hints to the compiler about the likelihood of a branch. Both likely() and
+ * unlikely() return the boolean value of the contained expression.
+ *
+ * These should only be used sparingly, in very hot code paths. It's very easy
+ * to mis-estimate likelihoods.
+ */
+#if __GNUC__ >= 3
+#define likely(x)      __builtin_expect((x) != 0, 1)
+#define unlikely(x) __builtin_expect((x) != 0, 0)
+#else
+#define likely(x)      ((x) != 0)
+#define unlikely(x) ((x) != 0)
+#endif
+

Review Comment:
   `likely` and `unlikely` are already defined in `c.h`. It's better not 
defined in another header file.
   If you prefer not include the header `c.h` in the source file, better define 
these macros inside the source file.
   It's unpredictable that if someone include both of the two headers, which 
will cause error for redefined macros.



-- 
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]

Reply via email to