Questions tagged [bitwise-operators]
low-level, primitive operations that directly manipulate bit patterns and binary numerals
57 questions
6 votes
3 answers
635 views
What is the term for a integer variable containing bit fields?
If I have a variable that is intended to to be used with bitmasks, to retrieve values, i.e. bit fields and flags, what is the academic term for such a variable? If the (bit) fields are a analogous to ...
2 votes
2 answers
277 views
Are bitwise operators in C used both for bit operations and for operations for integer or some C types?
In C, Bitwise logical operators &, |, ^ is used for selecting bits in a word. Bitwise shifting operators >> and << can be used for implementing multiplication and division between ...
1 vote
2 answers
2k views
In C++, Why do bitwise operators convert 8 or 16 bit integers to 32 bit?
Is there a logical reason why the integer is upgraded to 32+ bits? I was trying to make an 8bit mask, and found myself a bit disappointed that the upgrade will corrupt my equations. sizeof( quint8(0)...
4 votes
1 answer
5k views
Semantics of simulating a 64bit integer with two 32bit integers (hi, lo)
I am working in a system which only supports 32bit integers, in order to have a 64bit (unsigned) integer I decided to simply use two 32bit integers with one being the upper 32 bits (hi), and the other ...
-5 votes
5 answers
300 views
Do decimal equivalents to binary number values hold significance in software programming?
It seems as though in software engineering, we care more about these "on and off switch" usages of binary numbers more than the actual values of them numbers... For example, say I have the number: ...
2 votes
3 answers
731 views
What effects does memory space have on bitwise shifts?
It is true that the bitwise left shift operation (shl) doubles the value of the integer being shifted. However, when constrained to a finite space, such as 8 bits for example, left shift will begin to ...
1 vote
3 answers
976 views
How can I query, increment & decrement arbitrary-length integers encoded into a bit-array?
I'm in the process of implementing a counting Bloom filter. This data structure is defined as a bit-array and a "width" parameter, W. The bit array stores unsigned integers, whose size is determined ...
83 votes
7 answers
17k views
Why are bit masks called "masks" and what purpose do they serve?
Why are "bit masks" called like this? I know that they are mainly used for bitwise operations and the usage of bit masks is more efficient than the usage of separate variables. However my question ...