From 7510410b5660ba9027feb432f8f18940e000f376 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 15 Jun 2016 19:58:51 +0200 Subject: [PATCH] Smaller-type check fixed --- include/WinStd/Hex.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/WinStd/Hex.h b/include/WinStd/Hex.h index 9e78022e..52c9aaaa 100644 --- a/include/WinStd/Hex.h +++ b/include/WinStd/Hex.h @@ -144,13 +144,13 @@ namespace winstd int x = data[i]; if ('0' <= x && x <= '9') { - buf = (buf << 4) | (unsigned char)(x - '0'); + buf = ((buf & 0xf) << 4) | (unsigned char)(x - '0'); num++; } else if ('A' <= x && x <= 'F') { - buf = (buf << 4) | (unsigned char)(x - ('A' - 10)); + buf = ((buf & 0xf) << 4) | (unsigned char)(x - ('A' - 10)); num++; } else if ('a' <= x && x <= 'f') { - buf = (buf << 4) | (unsigned char)(x - ('a' - 10)); + buf = ((buf & 0xf) << 4) | (unsigned char)(x - ('a' - 10)); num++; } }