Magic Formulas ( Math , XOR Operation Properties )

Optimization due to repeated calculations.