{* *}
code teams

Bin To Dec



/*
** Efficient binary to decimal conversion. 
*/

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


unsigned long long int BinToDec(char *data)
{
    unsigned long long int  i, j = 0;
    while (data && *data && strchr("01", *data))
    {
        i = *data++ -'0';
        j <<=1;
        j |= (i & 0x01);
    }
    return j;
}