Actually those aren't API's, they're just macro's that expand to the bit masking/shifting stuff.
Be careful though; rbrunton is right with his mask, but what he probably did not realize when writing his examples is that the >> operator is a bit shifter, NOT a nibble shifter. it should be >>8 instead of >>2 and >>16 instead of >>4.
Greetings,
Rick