MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / Q_nibble

Function Q_nibble

tests/test_crypto.cpp:22–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20bool g_failed = false;
21
22static unsigned char Q_nibble( char c )
23{
24 if ( ( c >= '0' ) &&
25 ( c <= '9' ) )
26 {
27 return (unsigned char)(c - '0');
28 }
29
30 if ( ( c >= 'A' ) &&
31 ( c <= 'F' ) )
32 {
33 return (unsigned char)(c - 'A' + 0x0a);
34 }
35
36 if ( ( c >= 'a' ) &&
37 ( c <= 'f' ) )
38 {
39 return (unsigned char)(c - 'a' + 0x0a);
40 }
41
42 // received an invalid character, and no real way to return an error
43 // AssertMsg1( false, "Q_nibble invalid hex character '%c' ", c );
44 return 0;
45}
46
47#define min(x,y) (((x) > (y)) ? (y) : (x))
48

Callers 1

V_hextobinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected