Cast to the appropriate integer type