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


##########
include/endian.h:
##########
@@ -52,21 +52,50 @@
 /* Common byte swapping macros */
 
 #define __SWAP_UINT16_ISMACRO 1
-#undef  __SWAP_UINT32_ISMACRO
+#define __SWAP_UINT32_ISMACRO 1
+#define __SWAP_UINT64_ISMACRO 1
+
 
 #ifdef __SWAP_UINT16_ISMACRO
+#ifdef CONFIG_HAVE_BUILTIN_BSWAP16

Review Comment:
   ```suggestion
   #  ifdef CONFIG_HAVE_BUILTIN_BSWAP16
   ```



##########
include/endian.h:
##########
@@ -52,21 +52,50 @@
 /* Common byte swapping macros */
 
 #define __SWAP_UINT16_ISMACRO 1
-#undef  __SWAP_UINT32_ISMACRO
+#define __SWAP_UINT32_ISMACRO 1
+#define __SWAP_UINT64_ISMACRO 1
+
 
 #ifdef __SWAP_UINT16_ISMACRO
+#ifdef CONFIG_HAVE_BUILTIN_BSWAP16
+#    define __swap_uint16(n) ((uint16_t)__builtin_bswap16((uint32_t)(n)))
+#else
 #  define __swap_uint16(n) \

Review Comment:
   ```suggestion
   #    define __swap_uint16(n) \
   ```



##########
include/endian.h:
##########
@@ -52,21 +52,50 @@
 /* Common byte swapping macros */
 
 #define __SWAP_UINT16_ISMACRO 1
-#undef  __SWAP_UINT32_ISMACRO
+#define __SWAP_UINT32_ISMACRO 1
+#define __SWAP_UINT64_ISMACRO 1
+
 
 #ifdef __SWAP_UINT16_ISMACRO
+#ifdef CONFIG_HAVE_BUILTIN_BSWAP16
+#    define __swap_uint16(n) ((uint16_t)__builtin_bswap16((uint32_t)(n)))
+#else

Review Comment:
   ```suggestion
   #  else
   ```



##########
include/endian.h:
##########
@@ -52,21 +52,50 @@
 /* Common byte swapping macros */
 
 #define __SWAP_UINT16_ISMACRO 1
-#undef  __SWAP_UINT32_ISMACRO
+#define __SWAP_UINT32_ISMACRO 1
+#define __SWAP_UINT64_ISMACRO 1
+
 
 #ifdef __SWAP_UINT16_ISMACRO
+#ifdef CONFIG_HAVE_BUILTIN_BSWAP16
+#    define __swap_uint16(n) ((uint16_t)__builtin_bswap16((uint32_t)(n)))
+#else
 #  define __swap_uint16(n) \
     (uint16_t)(((((uint16_t)(n)) & 0x00ff) << 8) | \
                ((((uint16_t)(n)) >> 8) & 0x00ff))
 #endif

Review Comment:
   ```suggestion
   #  endif
   ```



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