How to check each bit in a binary number??

edited March 2014

I am looking for a method where i only by using And,OR and so on, can check each bit in a binary number, since each bit has it own instruction, it has to be interpreted in a certain way.
I would Normally have included all kind libraries to make such thing happen, but since it has to be done using arithmetically..

this is what i've managed to do so far..

``````void checkBit (binary_value)
{
if((binary_value<<7) == 1)
binary_value1 &= ~(0b00000001 << 7);
else
binary_value1 |= (0b00000001 << 7);

if((binary_value<<6) == 1)
binary_value1 &= ~(0b00000001 << 6);
else
binary_value1 |= (0b00000001 << 6);

if((binary_value<<5) == 1)
binary_value1 &= ~(0b00000001 << 5);
else
binary_value1 |= (0b00000001 << 5);

if((binary_value<<4) == 1)
binary_value1 &= ~(0b00000001 << 4);
else
binary_value1 |= (0b00000001 << 4);

if((binary_value<<3) == 1)
binary_value1 &= ~(0b00000001 << 3);
else
binary_value1 |= (0b00000001 << 3);

if((binary_value<<2) == 1)
binary_value1 &= ~(0b00000001 << 2);
else
binary_value1 |= (0b00000001 << 2);

if((binary_value<<1) == 1)
binary_value1 &= ~(0b00000001 << 1);
else
binary_value1 |= (0b00000001 << 1);

if((binary_value<<0) == 1)
binary_value1 &= ~(0b00000001 << 0);
else
binary_value1 |= (0b00000001 << 0);

}
``````

This is what i've managed to do so far.. but i am wondering if it is correctly made?
Because my program isn't working properly, so it's either this code piece or something else in my code..