Open yakra opened 2 years ago
std::string
char*
if (nibble > '9') nibble += 7;
nibble += (nibble > '9')*7;
"0123456789abcdef"[foo]
Branchless performs worse on lab5. Review other machines.
Review the Python implementation. "0123456789ABCDEF"[foo] is legal C++; maybe this can help.
"0123456789ABCDEF"[foo]
std::string
thousands of times. Allocate achar*
once per graph, pass in, and modify.if (nibble > '9') nibble += 7;
->nibble += (nibble > '9')*7;
"0123456789abcdef"[foo]
?~ Nah. Not too adaptable to the way the C++ routine does it. Good enough with the no-branch solution.