Replaced post-increments and -decrements with pre-increments and
-decrements where suitable, for efficiency.