Implement integer functions in a generic way