(v, index, x)
return v
Set the index:th bit of v to x, and return the new value.
Set the index:th bit of v to x, and return the new value.
Set the index : th bit of v to x and return the new value .
def set_bit(v, index, x):
    """Set the index:th bit of v to x, and return the new value."""
    mask = 1 << index
    if x:
        v |= mask
    else:
        v &= ~mask
    return v
def set_bit ( v , index , x ) : mask = 1 << index if x : v |= mask else : v &= ~ mask return v