def counter_delta(a, b):
	"""Gives a delta value between two counter values.
	
	Works with either 32-bit or 64-bit counter, but both
	arguments should be the same type.
	"""
	
	d = b - a
	if (d < 0):
		d = d + 2**32
		if (d <= 0):
			d = d + 2**64 - 2**32
	return d