def num2ver(ver):
    """
	Converts a string, tuple or version number into an integer. The number is supposed to have at most 4 digits::

		from waflib.Utils import num2ver
		num2ver('1.3.2') == num2ver((1,3,2)) == num2ver((1,3,2,0))

	:type ver: string or tuple of numbers
	:param ver: a version number
	"""
    if isinstance(ver, str):
        ver = tuple(ver.split('.'))
    if isinstance(ver, tuple):
        ret = 0
        for i in range(4):
            if i < len(ver):
                ret += 256 ** (3 - i) * int(ver[i])
        return ret
    return ver
