From 970e0147f7f73ada908563be71159fdaba09f7f8 Mon Sep 17 00:00:00 2001 From: Conrad Pankoff Date: Wed, 28 Aug 2019 10:13:08 +1000 Subject: [PATCH] AK: Make printf %x actually work properly When printing hex numbers, we were printing the wrong thing sometimes. This was because we were dividing the digit to print by 15 instead of 16. Also, dividing by 16 is the same as shifting four bits to the right, which is a bit closer to our actual intention in this case, so let's use a shift instead. --- AK/PrintfImplementation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h index 3034bfa6f9d..ff76889afdc 100644 --- a/AK/PrintfImplementation.h +++ b/AK/PrintfImplementation.h @@ -18,7 +18,7 @@ template int ret = 0; int digits = 0; - for (T n = number; n > 0; n /= 0x0f) + for (T n = number; n > 0; n >>= 4) ++digits; if (digits == 0) digits = 1;