can someone help me why this bitcount code does not work? : I'm now doing the bit.c lab, and I make the function bitCount, I think it's perfect but it cannot pass the test. I don't know why. please help!

    int bitCount(int x) {
    unsigned int a = 0x01010101;
    int b;
    int result = 0;
    result += a&x;
    result += a&(x>>1);
    result += a&(x>>2);
    result += a&(x>>3);
    result += a&(x>>4);
    result += a&(x>>5);
    result += a&(x>>6);
    result += a&(x>>7);
    b = result + result >> 8;
    b = b + result >> 16;
    b = b + result >> 24;
    return b&0xff;
}
