Microsoft interview question

Write a function to reverse an integer (i.e. 123 = 321), with O(1) space complexity.