MCPcopy Create free account
hub / github.com/F-Stack/f-stack / hex_digit_to_int

Function hex_digit_to_int

app/redis-6.2.6/src/sds.c:960–980  ·  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

958/* Helper function for sdssplitargs() that converts a hex digit into an
959 * integer from 0 to 15 */
960int hex_digit_to_int(char c) {
961 switch(c) {
962 case '0': return 0;
963 case '1': return 1;
964 case '2': return 2;
965 case '3': return 3;
966 case '4': return 4;
967 case '5': return 5;
968 case '6': return 6;
969 case '7': return 7;
970 case '8': return 8;
971 case '9': return 9;
972 case 'a': case 'A': return 10;
973 case 'b': case 'B': return 11;
974 case 'c': case 'C': return 12;
975 case 'd': case 'D': return 13;
976 case 'e': case 'E': return 14;
977 case 'f': case 'F': return 15;
978 default: return 0;
979 }
980}
981
982/* Split a line into arguments, where every argument can be in the
983 * following programming-language REPL-alike form:

Callers 1

sdssplitargsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected