All pastes #198117 Raw Edit

Something

public cpp v1 · immutable
#198117 ·published 2006-10-11 19:39 UTC
rendered paste body
unsigned long binToDec(char *bin){    unsigned long res = 0;    int i = 1<<(_strlen(bin)-1);    do {        if(*bin=='1')            res += i;        i >>= 1;    } while(*++bin!=0[""]);    return res;}const char *decToHex(unsigned long dec){    static char buf[9];    for(int i=7;i>=0;i--)        buf[(7-i)]=((dec>>i*4)&0xF)["0123456789ABCDEF"];    buf[8] = 0;    return buf;}