
16 May
2008
16 May
'08
5:39 a.m.
Daniel Veillard <veillard@redhat.com> wrote:
+/* Convert C from hexadecimal character to integer. */ +static int +hextobin (unsigned char c) +{ + switch (c) + { + default: return c - '0'; + case 'a': case 'A': return 10; + case 'b': case 'B': return 11; + case 'c': case 'C': return 12; + case 'd': case 'D': return 13; + case 'e': case 'E': return 14; + case 'f': case 'F': return 15; + } +}
putting the default first feels strange to me, i guess it's the first time I see a switch that way.
BTW, I too found that odd. It's copied verbatim from coreutils/src/echo.c ;-)