FreeCalypso > hg > freecalypso-tools
annotate uptools/libcoding/hexdecode2.c @ 981:f21798eb13cf
fc-loadtool: implement flash ppb-* commands
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 02 Dec 2023 05:46:00 +0000 |
parents | ec7e23d5151f |
children |
rev | line source |
---|---|
966
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module is a subset of hexdigits.c from fc-sim-tools/libutil. |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 decode_hex_digit(c) |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 { |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 if (c >= '0' && c <= '9') |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 return(c - '0'); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 if (c >= 'A' && c <= 'F') |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 return(c - 'A' + 10); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 if (c >= 'a' && c <= 'f') |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 return(c - 'a' + 10); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 return(-1); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 } |