Garmin interview question

Write a function to apply a bit mask.