def onesIndices(num):
    """Returns 0-based indices of set bits"""

    onesIndices = []
    bl = num.bit_length()
    for i in range(bl+1):
        if num & 0b1 == 1:
            onesIndices.append(i)
        num = num >> 1
    return onesIndices