xiaoxiang781216 commented on code in PR #6482:
URL: https://github.com/apache/incubator-nuttx/pull/6482#discussion_r901214743


##########
include/netinet/in.h:
##########
@@ -217,26 +217,30 @@
 /* This macro to convert a 16/32-bit constant values quantity from host byte
  * order to network byte order.  The 16-bit version of this macro is required
  * for uIP:
- *
- *   Author Adam Dunkels <a...@dunkels.com>
- *   Copyright (c) 2001-2003, Adam Dunkels.
- *   All rights reserved.
  */
 
 #ifdef CONFIG_ENDIAN_BIG
 # define HTONS(ns) (ns)
 # define HTONL(nl) (nl)
 #else
+# ifdef __has_builtin && __has_builtin(__builtin_bswap16)
+#  define HTONS(ns) ((unsigned short)__builtin_bswap16(((unsigned short) 
(ns))))

Review Comment:
   it's better to update the related macros in endian.h and forward HTONS to 
them.



##########
include/netinet/in.h:
##########
@@ -232,7 +232,7 @@
      ((((unsigned short)(ns)) >> 8) & 0x00ff))
 # endif
 # ifdef __has_builtin && __has_builtin(__builtin_bswap32)
-#  define HTONL(nl) ((unsigned long)__builtin_bswap32(((unsigned short) (nl))))
+#  define HTONL(nl) ((unsigned long)__builtin_bswap32(((unsigned long) (nl))))

Review Comment:
   merge to previous patch



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to