FreeCalypso > hg > fc-pcsc-tools
view libutil/hexdigits.c @ 225:208ae1633f6c
simtool code: sysmo.c renamed to sjs1_hacks.c,
comments changed to clarify that these special commands
apply only to the recently discontinued SJS1 cards
and not to the SJA2 successor.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 10 Mar 2021 19:39:33 +0000 |
parents | 3698c8192d2d |
children |
line wrap: on
line source
/* * This module contains elementary functions for working with hex digits. */ decode_hex_digit(c) { if (c >= '0' && c <= '9') return(c - '0'); if (c >= 'A' && c <= 'F') return(c - 'A' + 10); if (c >= 'a' && c <= 'f') return(c - 'a' + 10); return(-1); } encode_hex_digit(d) unsigned d; { if (d <= 9) return(d + '0'); else return(d - 10 + 'A'); }