Replaced old value swapping method

The new method only works for integers, but does not require the
creation of a temporary variable.