Variable bit select

In reply to ce_2015:

It would help if you showed some example values you are looking for. Maybe you just need a logical shift.

(b >> a)