20 if (
c <=
'9' &&
c >=
'0')
24 else if (
c <=
'f' &&
c >=
'a')
28 else if (
c <=
'F' &&
c >=
'A')
45 return 'A' + (char)l - 10;
55 return toByte(hex[pos], hex[pos + 1]);
64 std::string ret =
" ";
65 ret[0] =
toHex(
byte >> 4);
66 ret[1] =
toHex(
byte & 0x0F);
72 append.push_back(
toHex(
byte >> 4));
73 append.push_back(
toHex(
byte & 0x0F));
80 for (
unsigned i = 0; i <
length; i++)
82 ret[i * 2] =
toHex(buf[i] >> 4);
83 ret[i * 2 + 1] =
toHex(buf[i] & 0x0F);
__device__ __2f16 float c
static __inline__ uint8_t
uint8_t toByte(char h, char l)
converts 2 hex characters to a byte
std::string fromByte(uint8_t byte)
converts a byte to a hex string (without "0x" prefix);
std::string fromBytes(uint8_t *buf, size_t length)
converts a sequence of bytes to a representing hex string (without "0x" prefix)
uint8_t fromHex(char c)
convert a character to the hex value it represents(0-15)
char toHex(uint8_t l)
converts the lower 4 bits to a representing char
float __ovld __cnfn length(float p)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)