Handle lower case in FromHex().

This commit is contained in:
Kirill Zhdanovich 2013-04-14 14:02:58 +03:00 committed by Alex Zolotarev
parent 04500a4ce8
commit 6e0846ec57
2 changed files with 7 additions and 0 deletions

View file

@ -42,3 +42,8 @@ UNIT_TEST(EncodeNumber)
TEST_EQUAL(NumToHex(uint64_t(0x0123456789ABCDEFULL)),
"0123456789ABCDEF", ());
}
UNIT_TEST(DecodeLowerCaseHex)
{
TEST_EQUAL(FromHex("fe"), "\xfe", ());
}

View file

@ -27,6 +27,8 @@ namespace impl {
return (digit - '0');
else if (digit >= 'A' && digit <= 'F')
return (digit - 'A' + 10);
else if (digit >= 'a' && digit <= 'f')
return (digit - 'a' + 10);
ASSERT(false, (digit));
return 0;
}