The '- 1' adjusts the value as if it was even either way. The 'var % 2' returns the remainder of 'var / 2'; so, it returns '1' if odd or '0' if even. Multiplying that by 2 and adding will make the adjustment in the case that it is odd (and adjust by zero, or no additional change, in the case it is even).