Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

BINARY

Name: Anonymous 2010-11-10 18:20

So is this an efficient way to print out a 32bit little-endian integer in binary?


void printBinary(int number)
{
    char temp[33];
    char* p = &temp[32];
    int mask = 1;
    *p = 0;
    for (int i = 0; i < 32; ++i)
    {
        --p;
        *p = (number & mask) + 48;
        mask <<= 1;
    }
    puts(temp);
}

Name: Anonymous 2010-11-10 19:46

>>7,10
Undefined behavior detected: being a fucking faggot.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List