MCPcopy Create free account
hub / github.com/antirez/botlib / hex_digit_to_int

Function hex_digit_to_int

sds.c:918–938  ·  view source on GitHub ↗

Helper function for sdssplitargs() that converts a hex digit into an * integer from 0 to 15 */

Source from the content-addressed store, hash-verified

916/* Helper function for sdssplitargs() that converts a hex digit into an
917 * integer from 0 to 15 */
918int hex_digit_to_int(char c) {
919 switch(c) {
920 case '0': return 0;
921 case '1': return 1;
922 case '2': return 2;
923 case '3': return 3;
924 case '4': return 4;
925 case '5': return 5;
926 case '6': return 6;
927 case '7': return 7;
928 case '8': return 8;
929 case '9': return 9;
930 case 'a': case 'A': return 10;
931 case 'b': case 'B': return 11;
932 case 'c': case 'C': return 12;
933 case 'd': case 'D': return 13;
934 case 'e': case 'E': return 14;
935 case 'f': case 'F': return 15;
936 default: return 0;
937 }
938}
939
940/* Split a line into arguments, where every argument can be in the
941 * following programming-language REPL-alike form:

Callers 1

sdssplitargsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected