Comparison functions. Implementation for basic types