You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/07 07:04:24 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7028: Add some utility functions for nuttx.h

pkarashchenko commented on code in PR #7028:
URL: https://github.com/apache/incubator-nuttx/pull/7028#discussion_r964460446


##########
include/nuttx/nuttx.h:
##########
@@ -48,4 +48,83 @@
 #define container_of(ptr, type, member) \
   ((type *)((uintptr_t)(ptr) - offsetof(type, member)))
 
+/* Name: max_t
+ *
+ * Description:
+ *   return maximum of two values, using the specified type
+ *
+ * Arguments:
+ *   type - data type to use
+ *   x    - first value
+ *   y    - second value
+ */
+
+#ifndef max_t
+#define max_t(type, x, y) ({               \
+        type _max1 = (x);                  \
+        type _max2 = (y);                  \
+        _max1 > _max2 ? _max1 : _max2; })

Review Comment:
   this seems to be GCC specific only



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org