Top "Bit-manipulation" questions

The manipulation of individual bits.

Flags enum & bitwise operations vs. “string of bits”

A fellow developer suggested we store a selection of days of the week as 7-character string of 1’s and 0’s, …

c# bit-manipulation enum-flags
Verilog signed vs unsigned samples and first

Assuming I have a register reg [15:0] my_reg, which contains a 16-bit signed sample: How do I convert the sample …

bit-manipulation verilog hdl
How can I bitwise XOR two C char arrays?

I feel silly for not being able to figure this out, but I am lost. I am trying to XOR …

c arrays char bit-manipulation xor
What's the fastest way to divide an integer by 3?

int x = n / 3; // <-- make this faster // for instance int a = n * 3; // <-- normal integer multiplication int b = (…

optimization bit-manipulation division
Given an integer, how do I find the next largest power of two using bit-twiddling?

If I have a integer number n, how can I find the next number k > n such that k = 2^…

language-agnostic bit-manipulation
Manipulate alpha bytes of Java/Android color int

If I have an int in Java that I'm using as an Android color (for drawing on a Canvas), how …

java android bit-manipulation
Checking flag bits java

I have a problem with flag bits. I have an int variable to hold flags. First I set some flags …

java bit-manipulation flags
How to flip a specific bit in a byte in C?

I'm trying to use masks and manipulating specific bits in a byte. For example: I want to write a program …

c bit-manipulation bit
What is an XOR sum?

I am not sure of the precise definition of this term. I know that a bitwise XOR operation is going …

c bit-manipulation bit xor
Extract fractional part of double *efficiently* in C

I'm looking to take an IEEE double and remove any integer part of it in the most efficient manner possible. …

c floating-point double micro-optimization bit-manipulation