long bin2dec(char *s) { long r=0; for (; *s; r = (r<<1) | (*s++ - '0')); return r; }