MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ParseHex

Function ParseHex

Source/Engine/Platform/StringUtils.h:206–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204 // Parses text to unsigned integer value. Returns true if failed to convert the value.
205 template<typename T>
206 static bool ParseHex(const T* str, int32 length, uint32* result)
207 {
208 uint32 sum = 0;
209 const T* p = str;
210 const T* end = str + length;
211 if (*p == '0' && *(p + 1) == 'x')
212 p += 2;
213 while (*p && p < end)
214 {
215 int32 c = *p - '0';
216 if (c < 0 || c > 9)
217 {
218 c = ToLower(*p) - 'a' + 10;
219 if (c < 10 || c > 15)
220 return true;
221 }
222 sum = 16 * sum + c;
223 p++;
224 }
225 *result = sum;
226 return false;
227 }
228
229 // Parses text to unsigned integer value. Returns true if failed to convert the value.
230 template<typename T>

Callers 4

GuidParseFunction · 0.85
ParseIDMethod · 0.85
DeserializeMethod · 0.85
GetGuidMethod · 0.85

Calls 1

LengthFunction · 0.50

Tested by

no test coverage detected