Qualcomm interview question

How to write a bitmask function in C