Accessing bit level in C++

Started by
11 comments, last by DataProtocol 20 years, 2 months ago
quote:Original post by Leffe That would be 32 bytes, bools are as large as integers, 4 bytes.


Not on all compilers and platforms. VC6''s bool is only 1 byte. (I just checked with a test program to make sure). The #defined BOOL used in many Windows programs, however, is 4 bytes.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
Advertisement
oh gad, don''t you people have anything better to do than nitpick each others comments?
DataProtocol:
If you really need to save memory, you could look into some simple compression techniques. Just decompress the maps as you need them.

If that's no good, vector<bool> (as suggested by Jingo) is a good alternative. In most implementations, a vector of booleans is actually a stored as a bitstring in memory.

Failing that, you're stuck with the bitwise and/or operators.

quote:Original post by rypyr
oh gad, don't you people have anything better to do than nitpick each others comments?

One could ask you the same question

[edited by - glassJAw on January 23, 2004 5:59:06 PM]

This topic is closed to new replies.

Advertisement