I am writing a toggle bit which toggles the nth bit of a number function in x86-64 bit: But it is not working, especially for when the nth bit is 0 or 3. How can i fix this? Please help.
toggle_bit:
push rdi
push rsi
shl rsi, 1
xor rid, rsi
mov rax, rdi
pop rdi
pop rsi
ret