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/10/31 18:31:24 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7491: Fix the warning found by https://github.com/apache/incubator-nuttx/pull/7391

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


##########
net/sixlowpan/sixlowpan_internal.h:
##########
@@ -103,15 +103,15 @@
 /* GET 16-bit data:  source in network order */
 
 #define GETUINT16(ptr,index) \
-  ((((uint16_t)((ptr)[index])) << 8) | ((uint16_t)(((ptr)[(index) + 1]))))
+  ((uint16_t)(((ptr)[index] << 8) | (ptr)[(index) + 1]))
 
 /* PUT 16-bit data:  source in host order, result in network order */
 
 #define PUTHOST16(ptr,index,value) \
   do \
     { \
-      (ptr)[index]     = ((uint16_t)(value) >> 8) & 0xff; \
-      (ptr)[index + 1] = (uint16_t)(value) & 0xff; \
+      (ptr)[index]     = ((value) >> 8) & 0xff; \

Review Comment:
   ditto



##########
net/sixlowpan/sixlowpan_internal.h:
##########
@@ -103,15 +103,15 @@
 /* GET 16-bit data:  source in network order */
 
 #define GETUINT16(ptr,index) \
-  ((((uint16_t)((ptr)[index])) << 8) | ((uint16_t)(((ptr)[(index) + 1]))))
+  ((uint16_t)(((ptr)[index] << 8) | (ptr)[(index) + 1]))

Review Comment:
   what is the warning here?



##########
include/nuttx/usb/usb.h:
##########
@@ -65,10 +65,10 @@
 #define MSBYTE(u16)                             ((u16) >> 8)     /* Get MS byte from uint16_t */
 #define LSBYTE(u16)                             ((u16) & 0xff)   /* Get LS byte from uint16_t */
 
-#define GETUINT16(p)                            (((uint16_t)p[1] << 8) | (uint16_t)p[0])
-#define GETUINT32(p)                            (((uint32_t)p[3] << 24) | \
-                                                 ((uint32_t)p[2] << 16) | \
-                                                 ((uint32_t)p[1] << 8) | (uint32_t)p[0])
+#define GETUINT16(p)                            ((uint16_t)((p[1] << 8) | p[0]))

Review Comment:
   what is the warning here?



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