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 09:25:18 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7476: arch/arm: Typedef _[u]int32_t to __[U]INT32_TYPE__ if __INT32_TYPE__ is defined

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


##########
arch/arm/include/inttypes.h:
##########
@@ -31,89 +31,130 @@
 
 #define PRId8       "d"
 #define PRId16      "d"
-#define PRId32      "ld"
+#if defined(__INT32_TYPE__) && __INT32_TYPE__ == 2
+#  define PRId32    "d"
+#else
+#  define PRId32    "ld"
+#endif
 #define PRId64      "lld"
-
 #define PRIdPTR     "d"
 
 #define PRIi8       "i"
 #define PRIi16      "i"
-#define PRIi32      "li"
+#if defined(__INT32_TYPE__) && __INT32_TYPE__ == 2
+#  define PRIi32    "i"
+#else
+#  define PRIi32    "li"
+#endif
 #define PRIi64      "lli"
-
 #define PRIiPTR     "i"
 
 #define PRIo8       "o"
 #define PRIo16      "o"
-#define PRIo32      "lo"
+#if defined(__INT32_TYPE__) && __INT32_TYPE__ == 2
+#  define PRIo32    "o"
+#else
+#  define PRIo32    "lo"
+#endif
 #define PRIo64      "llo"
-
 #define PRIoPTR     "o"
 
 #define PRIu8       "u"
 #define PRIu16      "u"
-#define PRIu32      "lu"
+#if defined(__INT32_TYPE__) && __INT32_TYPE__ == 2
+#  define PRIu32    "u"
+#else
+#  define PRIu32    "lu"
+#endif
 #define PRIu64      "llu"
-
 #define PRIuPTR     "u"
 
 #define PRIx8       "x"
 #define PRIx16      "x"
-#define PRIx32      "lx"
+#if defined(__INT32_TYPE__) && __INT32_TYPE__ == 2
+#  define PRIx32    "x"
+#else
+#  define PRIx32    "lx"
+#endif
 #define PRIx64      "llx"
-
 #define PRIxPTR     "x"
 
 #define PRIX8       "X"
 #define PRIX16      "X"
-#define PRIX32      "lX"
+#if defined(__INT32_TYPE__) && __INT32_TYPE__ == 2

Review Comment:
   You mean other arch? Since uint32_t definition in other arch is fixed, I think the current solution is fine.



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