acassis commented on a change in pull request #572: URL: https://github.com/apache/incubator-nuttx-apps/pull/572#discussion_r565992790
########## File path: nshlib/nsh_printf.c ########## @@ -84,7 +87,34 @@ int cmd_printf(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { case 'x': fmt++; - nsh_output(vtbl, "%c", strtol(fmt, NULL, 16)); + value = strtol(fmt, NULL, 16); + len = strnlen(fmt, 10); + + /* Is it a Big Endian MCU ? */ + + if (BYTE_ORDER == BIG_ENDIAN) + { + value = __swap_uint32(value); + } + + if (len == 8) + { + nsh_output(vtbl, "%c%c%c%c", value & 0xff, + (value & 0xff00) >> 8, + (value & 0xff0000) >> 16, + (value & 0xff000000) >> 24); + } + else + if (len == 4) Review comment: I use to do this way, but I could keep it in a single line. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org