MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / convertCharToHex

Function convertCharToHex

lib/common/hexstr.cpp:11–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace WasmEdge {
10
11uint8_t convertCharToHex(const char C) {
12 if (C >= '0' && C <= '9') {
13 return static_cast<uint8_t>(C - '0') + UINT8_C(0);
14 }
15 if (C >= 'a' && C <= 'f') {
16 return static_cast<uint8_t>(C - 'a') + UINT8_C(10);
17 }
18 if (C >= 'A' && C <= 'F') {
19 return static_cast<uint8_t>(C - 'A') + UINT8_C(10);
20 }
21 return UINT8_C(0);
22}
23
24void convertBytesToHexStr(Span<const uint8_t> Src, std::string &Dst,
25 const uint32_t Padding, const bool IsLittleEndian) {

Callers 1

convertHexStrToBytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected