Function to invert a section of an int.

Exercise 2-7.