There are a couple of functions to get information on arbitrary bits in an MPI and to set or clear them:
Return the number of bits required to represent a.
Return true if bit number n (counting from 0) is set in a.
Set bit number n in a and clear all bits greater than n.
Clear bit number n in a and all bits greater than n.