MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / hexstrtouint8

Function hexstrtouint8

rEFIt_UEFI/Platform/Utils.cpp:36–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34//}
35
36UINT8 hexstrtouint8 (const CHAR8* buf)
37{
38 INT8 i = 0;
39 if (IS_DIGIT(buf[0]))
40 i = buf[0]-'0';
41 else if (IS_HEX(buf[0]))
42 i = (buf[0] | 0x20) - 'a' + 10;
43
44 if (AsciiStrLen(buf) == 1) {
45 return i;
46 }
47 i <<= 4;
48 if (IS_DIGIT(buf[1]))
49 i += buf[1]-'0';
50 else if (IS_HEX(buf[1]))
51 i += (buf[1] | 0x20) - 'a' + 10;
52
53 return i;
54}
55
56BOOLEAN IsHexDigit (CHAR8 c) {
57 return (IS_DIGIT(c) || (IS_HEX(c)))?TRUE:FALSE;

Callers 2

GetUserSettingsFunction · 0.85
hex2binFunction · 0.85

Calls 1

AsciiStrLenFunction · 0.85

Tested by

no test coverage detected