summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-06-07 13:38:16 -0700
committerGerrit <chrome-bot@google.com>2012-06-07 14:33:26 -0700
commit8fcfec5f7f80d521aad34b6b503455de2b84bbc2 (patch)
tree1246d90348c88cb2a1f084694930cfa2562ad5ff
parent20d730b322fde1a5785b493a99a3b702cef2f793 (diff)
downloadchrome-ec-8fcfec5f7f80d521aad34b6b503455de2b84bbc2.tar.gz
Fix printing hex numbers
Off-by-one is not my friend. BUG=chrome-os-partner:10206 TEST=manual 1. rw 0x20000000 2. ww back the same number printed 3. rw 0x20000000. should match Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I61e0d26cf4cb274a88326d4e7d24ff1c82d6e515 Reviewed-on: https://gerrit.chromium.org/gerrit/24756 Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/printf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/printf.c b/common/printf.c
index af393daa0b..d6b0298034 100644
--- a/common/printf.c
+++ b/common/printf.c
@@ -163,9 +163,9 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context,
if (digit < 10)
*(--vstr) = '0' + digit;
else if (c == 'X')
- *(--vstr) = 'A' + digit - 9;
+ *(--vstr) = 'A' + digit - 10;
else
- *(--vstr) = 'a' + digit - 9;
+ *(--vstr) = 'a' + digit - 10;
}
if (is_negative)