MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / iHexCharToInt

Function iHexCharToInt

samples/shared/strtools.cpp:232–243  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Purpose: Helper for converting a hex char value to numeric, return -1 if the char is not a valid hex digit. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

230// is not a valid hex digit.
231//-----------------------------------------------------------------------------
232int iHexCharToInt( char cValue )
233{
234 int32_t iValue = cValue;
235 if ( (uint32_t)( iValue - '0' ) < 10 )
236 return iValue - '0';
237
238 iValue |= 0x20;
239 if ( (uint32_t)( iValue - 'a' ) < 6 )
240 return iValue - 'a' + 10;
241
242 return -1;
243}
244
245//-----------------------------------------------------------------------------
246// Purpose: Internal implementation of encode, works in the strict RFC manner, or

Callers 1

V_URLDecodeInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected