Top "Bit-manipulation" questions

The manipulation of individual bits.

Add two integers using only bitwise operators?

In C#, is it possible to perform a sum of two 32-bit integers without using things like if..else, loops …

c# bit-manipulation
BitSet to and from integer/long

If I have an integer that I'd like to perform bit manipulation on, how can I load it into a …

java bit-manipulation bitset
Unsigned Integer in Javascript

I'm working on a page that processes IP address information, but it's choking on the fact that integers are signed. …

javascript bit-manipulation unsigned
Explain the use of a bit vector for determining if all characters are unique

I am confused about how a bit vector would work to do this (not too familiar with bit vectors). Here …

java string bit-manipulation bitvector
What does a tilde do when it precedes an expression?

var attr = ~'input,textarea'.indexOf( target.tagName.toLowerCase() ) ? 'value' : 'innerHTML' I saw it in an answer, and I've never seen …

javascript syntax bit-manipulation
Mod of power 2 on bitwise operators?

How does mod of power of 2 work on only lower order bits of a binary number (1011000111011010)? What is this number …

c math bit-manipulation bitwise-operators bitwise-and
Bitfield manipulation in C

The classic problem of testing and setting individual bits in an integer in C is perhaps one the most common …

c bit-manipulation
Algorithm to generate bit mask

I was facing this unique problem of generating a bit-mask based on the input parameter. For example, if param = 2, then …

c algorithm bit-manipulation
Why is XOR the default way to combine hashes?

Say you have two hashes H(A) and H(B) and you want to combine them. I've read that a …

cryptography bit-manipulation hash probability xor
Two's Complement Binary in Python?

Integers in Python are stored in two's complement, correct? Although: >>> x = 5 >>> bin(x) 0b101 …

python binary bit-manipulation