Top "Bit-manipulation" questions

The manipulation of individual bits.

What are bitwise shift (bit-shift) operators and how do they work?

I've been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (…

language-agnostic bit-manipulation operators bit-shift binary-operators
How to count the number of set bits in a 32-bit integer?

8 bits representing the number 7 look like this: 00000111 Three bits are set. What are algorithms to determine the number of set …

algorithm binary bit-manipulation hammingweight iec10967
What is “2's Complement”?

I'm in a computer systems course and have been struggling, in part, with Two's Complement. I want to understand it …

binary bit-manipulation computer-science twos-complement data-representation
What is Bit Masking?

I am fairly new to C programming, and I encountered bit masking. Can someone explain to me the general concept …

c bit-manipulation bitwise-operators terminology bitmask
C# int to byte[]

I need to convert an int to a byte[] one way of doing it is to use BitConverter.GetBytes(). But …

c# .net bit-manipulation nfs
C/C++ check if one bit is set in, i.e. int variable

int temp = 0x5E; // in binary 0b1011110. Is there such a way to check if bit 3 in temp is 1 or 0 …

c++ c bit-manipulation
Efficient Algorithm for Bit Reversal (from MSB->LSB to LSB->MSB) in C

What is the most efficient algorithm to achieve the following: 0010 0000 => 0000 0100 The conversion is from MSB->LSB to LSB-&…

c algorithm bit-manipulation