Category "bit-manipulation"

How to find if there are n consecutive set bits in a 32 bit buffer?

Maybe you can help me with the following problem that can help me speed a memory manager I am thinking of (I am not sure a solution exists – I did not fin

XOR Operation Intuition

I recently came across this question on Leetcode and figured out a solution that I need some clarification with: Given an array of integers, every element a

bitwise operators with an if

I am reading K&R book for c language and in section 2.10 they give the following example: /*bitcount: count 1 bits in x*/ int bitcount(unsigned x) { in

What are assembly instructions like PEXT actually used for?

I watched a youtube video on the Top 10 Craziest Assembly Language Instructions and some of these instructions have no obvious application to me. What's the poi

Finding consecutive bit string of 1 or 0

How to find the length of the longest consecutive bit string(either 1 or 0)? 00000000 11110000 00000000 00000000 -> If it is 0 then length will be 20 111