Top "Bit-manipulation" questions

The manipulation of individual bits.

What is (x & 1) and (x >>= 1)?

I am trying to do assignment: "Find the number of bits in an unsigned integer data type without using the …

c++ bit-manipulation bitwise-operators bit-shift bitwise-and
What does AND 0xFF do?

In the following code: short = ((byte2 << 8) | (byte1 & 0xFF)) What is the purpose of &0xFF? Because other …

c bit-manipulation bitwise-operators bit-shift
'and' (boolean) vs '&' (bitwise) - Why difference in behavior with lists vs numpy arrays?

What explains the difference in behavior of boolean and bitwise operations on lists vs NumPy arrays? I'm confused about the …

python numpy bit-manipulation boolean-expression ampersand
Implement division with bit-wise operator

How can I implement division using bit-wise operators (not just division by powers of 2)? Describe it in detail.

bit-manipulation bit
Bitwise operator for simply flipping all bits in an integer?

I have to flip all bits in a binary representation of an integer. Given: 10101 The output should be 01010 What is …

java binary bit-manipulation bit bitwise-operators
Checking if a bit is set or not

How to check if a certain bit in a byte is set? bool IsBitSet(Byte b,byte nPos) { return .....; }

c# .net bit-manipulation
get absolute value without using abs function nor if statement

I was thinking how to get the absolute value of an integer without using if statement nor abs(). At first …

c++ c bit-manipulation
How can I remove a flag in C?

There is a variable that holds some flags and I want to remove one of them. But I don't know …

c bit-manipulation flags
Java "Bit Shifting" Tutorial?

I would be thankful for a good tutorial, that explain for java newbies how in java all the "bit shifting" …

java bit-manipulation bit-shift
Arithmetic bit-shift on a signed integer

I am trying to figure out how exactly arithmetic bit-shift operators work in C, and how it will affect signed 32…

c bit-manipulation