Is there any command in stl that converts ascii data to the integer form of its hex representation? such as: "abc" -> 0x616263.
i have the most basic way i can think of:
uint64_t tointeger(std::string){
std::string str = "abc";
uint64_t value = 0; // allow max of 8 chars
for(int x = 0; x < str.size(); x++)
value = (value << 8) + str[x];
return value;
}
as stated above: tointeger("abc");
returns the value 0x616263
but this is too slow. and because i have to use this function hundreds of thousands of times, it has slowed down my program significantly. there are 4 or 5 functions that rely on this one, and each of those are called thousands of times, in addition to this function being called thousands of times
what is a faster way to do this?