In 64-bit ASM. Is there a good way of NOTING only the lower 32 bits of the register

Assuming we have some value in RAX. We want NOT the lower 32-bit RAX and leave the upper 32 bits unchanged. Is there a good way to do this?

A command like:

not eax

Unfortunately, zero continues.

I can do it like this:

mov rbx,rax
not ebx ; or not rbx
and rax, 0xffffffff00000000
or rax, rbx

but there seems to be a nicer way.

+4
source share
1 answer

You can use XOR with 0x00000000ffffffff, which will flip the bottom 32 bits.

+6
source

All Articles