# Use bitwise operations in Python

# Bit-wise AND
def bw_and(a, b):
    return a & b

# Bit-wise OR
def bw_or(a, b):
    return a | b

# Bit-wise XOR
def bw_xor(a, b):
    return a ^ b

# Shift Left
def shift_left(var, pos):
    return var << pos

# Shift right
def shift_right(var, pos):
    return var >> pos

# Toggle
def toggle(var):
    return ~var


