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

C++ for dummies

Name: Anonymous 2008-02-06 8:11

It may seem odd to have a command in C++ (or any other programming language)
that’s specifically ignored by the computer. However, all computer languages
have some version of the comment. It’s critical that the programmer
explain what was going through her mind when she wrote the code. A programmer’s
thoughts may not be obvious to the next colleague who picks up
her program and tries to use it or modify it. In fact, the programmer herself
may forget what her program meant if she looks at it months after writing the
original code and has left no clue.

Name: Anonymous 2008-02-07 12:20


n = ((n >>  1) & 0x55555555) | ((n <<  1) & 0xaaaaaaaa);
n = ((n >>  2) & 0x33333333) | ((n <<  2) & 0xcccccccc);
n = ((n >>  4) & 0x0f0f0f0f) | ((n <<  4) & 0xf0f0f0f0);
n = ((n >>  8) & 0x00ff00ff) | ((n <<  8) & 0xff00ff00);
n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000);

// Reverse the bits in a word.

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