Function that converts between different types. This first commit adds only conversion between integral types.