56#ifndef ETISS_INCLUDE_GDB_HEX_H_
57#define ETISS_INCLUDE_GDB_HEX_H_
59#include "etiss/jit/types.h"
124template <
typename INT>
131void fromInt(std::string &
string, INT val,
bool isLittleEndian)
133 for (
size_t i = 0; i <
sizeof(INT); i++)
135 fromByte(
string, (
uint8_t)(val >> (isLittleEndian ? (i * 8) : ((
sizeof(INT) - i - 1) * 8))));
131void fromInt(std::string &
string, INT val,
bool isLittleEndian) {
…}
139template <
typename INT>
144INT
toInt(
const std::string &
string,
bool isLittleEndian,
size_t pos = 0)
147 for (
unsigned i = 0; i < static_cast<unsigned>(
sizeof(INT)); i++)
149 ret |= ((((INT)
toByte(
string, pos + i * 2)) & ((INT)0xFF))
150 << (isLittleEndian ? (i * 8) : ((
sizeof(INT) - i - 1) * 8)));
144INT
toInt(
const std::string &
string,
bool isLittleEndian,
size_t pos = 0) {
…}
154template <
typename INT>
163INT
tryInt(std::string &
string,
unsigned &pos,
size_t maxlength =
sizeof(INT) * 2)
167 while (
string.
length() > pos && pos - opos < maxlength)
172 ret = (ret << 4) | hb;
163INT
tryInt(std::string &
string,
unsigned &pos,
size_t maxlength =
sizeof(INT) * 2) {
…}
__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);
INT tryInt(std::string &string, unsigned &pos, size_t maxlength=sizeof(INT) *2)
parses a hex string and returns the result.
INT toInt(const std::string &string, bool isLittleEndian, size_t pos=0)
convert a string of length (pos + sizeof(INT)) or larger to the represented value.
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)
void fromInt(std::string &string, INT val, bool isLittleEndian)
converts an integer type variable to a hexadecimal representation with the given endianness
char toHex(uint8_t l)
converts the lower 4 bits to a representing char
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
float __ovld __cnfn length(float p)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)