Ich gehe mal davon aus das es sich um C handelt.
Eventuell so?
data_b ^= maske & data_a;

Edit:
Ach nee, dann nimmt er die Nullen nicht mit