I had a funny incident. when i saw this question posted, i began solving it, but later it turned out that the way i solved it was wrong. but to my astonishment i got the right answer ( -7 ).
this is what i did :
b = b >> 1 ( this is wrong , but bear with me till i finish )
-13 in binary , take + 13 first
0000 1101
flip bits
1111 0010
add 1
1111 0011
alright now right shift by one.
we have
1111 1001
now this is negative , to get the decimal number , do the usual stuff.
flip bits
0000 0110
add 1
0000 0111
we get it !!!
-7
but its wrong , wrong ,wrong.....
Thanks to Corey , he explained the right way...
thanks dude !!!
keep up the good work.