Improve the performance of OrAndMask.apply()
Improve the performance of AndOrMask.apply()