def getPositions(mask):
    """
    Get a list of positions where the specified
    mask has the bit set
    """
    # XXX I don't exactly love this implementation,
    # but it works.
    binaryString = bin(mask)[2:]
    result = []
    for index, c in enumerate(binaryString[::-1]):
        if int(c):
            result.append(index)
    return result