**Note** - This is NOT a duplicate of this question - [Count the consecutive zero bits (trailing) on the right in parallel: an explanation?](https://stackoverflow.com/questions/21299354/count-the-consecutive-zero-bits-trailing-on-the-right-in-parallel-an-explanat) . The linked question has a different context, it only asks the purpose of `signed()` being use. DO NOT mark this question as duplicate.

I've been finding a way to acquire the number of trailing zeros in a number. I found a bit twiddling [Stanford University Write up HERE](http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightParallel) here that gives the following explanation. 

```
unsigned int v;      // 32-bit word input to count zero bits on right
unsigned int c = 32; // c will be the number of zero bits on the right
v &= -signed(v);
if (v) c--;
if (v & 0x0000FFFF) c -= 16;
if (v & 0x00FF00FF) c -= 8;
if (v & 0x0F0F0F0F) c -= 4;
if (v & 0x33333333) c -= 2;
if (v & 0x55555555) c -= 1;

```

Why does this end up working ? I have an understanding of how Hex numbers are represented as binary and bitwise operators, but I am unable to figure out the intuition behind this working ? What is the working mechanism ?