implementation of intmap_difference