Correct typecasts between integers and pointers