def number2powers(n):
    """
    Converts an integer value to list of powers of 2.
    :param n: integer value to convert
    :type n: int
    :return: list of powers of 2
    """
    s = 1
    while n >= s:
        if n & s:
            yield s
        s <<= 1
