From: Daniel Gudbjartsson dfg@decode.is
static int char2digit(char c, int base) {
- if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0');
- if ((c>='0') && (c<='9') && (c<='0')+base-1) return (c-'0');
First off, I can't parse the above. It's A && B && C + base -1. What is that?!?
If you intend to clean it up, make it more readable: + if (('0' <= c) && (c <= min('0'+base-1, '9')) return c-')';
'cause that's what you want to say: if c is a valid digit (but no more then '9') in the given base, right?
-- Dimi.