From 3bdba552489cde1ea61f7169a31e57ce8929e4c8 Mon Sep 17 00:00:00 2001 From: Richard Yu Date: Sat, 12 Jan 2019 22:44:14 +0800 Subject: [PATCH] misc: fix hex2char reverse. --- util/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/misc.c b/util/misc.c index e040f1f..60c445f 100644 --- a/util/misc.c +++ b/util/misc.c @@ -39,8 +39,8 @@ uint8_t char2hex(const char* str) { void hex2char(uint8_t hex, char* out) { #define HEX2LOWER(digit) (((digit) >= 0xa) ? ((digit) - 0xa + 'a') : ((digit) + '0')) - out[0] = HEX2LOWER(hex & 0xf); - out[1] = HEX2LOWER((hex & 0xf0) >> 4); + out[0] = HEX2LOWER((hex & 0xf0) >> 4); + out[1] = HEX2LOWER(hex & 0xf); } char* my_itoa(int val, char* buf, uint32_t radix) {