Top "Bit-manipulation" questions

The manipulation of individual bits.

Converting `UInt16` to byte array

How to convert an UInt16 valu to a byte array of size 2 I found some code in MSDN but I …

c# .net bit-manipulation bitconverter
Zig Zag Decoding

In the google protocol buffers encoding overview, they introduce something called "Zig Zag Encoding", this takes signed numbers, which have …

language-agnostic bit-manipulation protocol-buffers bitfoo zigzag-encoding
How to efficiently de-interleave bits (inverse Morton)

This question: How to de-interleave bits (UnMortonizing?) has a good answer for extracting one of the two halves of a …

bit-manipulation z-order-curve
BITWISE AND(&) for Range of Numbers

Given two numbers L & R , Find Bitwise AND of all numbers lying between L and R inclusive Constraints 1<= …

bit-manipulation bitwise-operators bitwise-and
JavaScript Endian Encoding?

A response on SO got me thinking, does JavaScript guarantee a certain endian encoding across OSs and browsers? Or put …

javascript encoding bit-manipulation endianness
Convert uint8_t hex value to binary

So like it says in the title I am trying to convert a hexadecimal into a binary. But the problem …

c binary hex bit-manipulation uint32-t
Bitwise subtraction

Given the enum: [Flags] enum foo { a = 1, b = 2, c = 4 } then foo example = a | b; If I don't know if foo …

c# bit-manipulation bitmask
C Bit fields in C#

I need to translate a C struct to C# which uses bit fields. typedef struct foo { unsigned int bar1 : 1; unsigned …

c# c bit-manipulation code-conversion
Bitwise saturated addition in C (HW)

I'm working on an assignment and I can't figure out how to implement this. I have to make a function …

c bit-manipulation addition saturation-arithmetic
Using a bitwise & inside an if statement

In C, I can write an if-statement if (firstInt & 1) but when I try and do the same in Java, …

java c if-statement bit-manipulation operator-keyword