MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / axtoi

Function axtoi

Descent3/pilot.cpp:2123–2137  ·  view source on GitHub ↗

axtoi Convert a string that represents a hex value into an int (like atoi)

Source from the content-addressed store, hash-verified

2121//
2122// Convert a string that represents a hex value into an int (like atoi)
2123int axtoi(char *p) {
2124 int value = 0;
2125
2126 while ((p) && (*p)) {
2127 *p = toupper(*p);
2128 if ((*p >= '0') && (*p <= '9'))
2129 value = (value * 16) + ((*p) - '0');
2130 else if ((*p >= 'A') && (*p <= 'F'))
2131 value = (value * 16) + (((*p) - 'A') + 10);
2132 else
2133 return 0;
2134 p++;
2135 }
2136 return value;
2137}
2138
2139// StripCRCFileName
2140//

Callers 1

StripCRCFileNameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected