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

Two values in one variable

Name: Anonymous 2010-01-16 18:52

Let's say you have two small values that will never get past 10, and you use the first four bits of a char for the first var and the last bits for the second var. Do people do that?

Name: Anonymous 2010-01-16 18:56

>>1
Not generally if they have any sense. If you're out of memory and it's not at all speed-critical, do it. If it's even slightly speed-critical, optimize your memory use instead. If you're programming an actual computer, don't do it. You're just making your program more complicated for no reason, and potentially slower if these are accessed at all in your inner loops.

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