How do I negate a 64-bit integer stored in a 32-bit register pair?
问题 I've stored a 64-bit integer in the EDX:EAX register pair . How can I correctly negate the number? For example: 123456789123 → -123456789123 . 回答1: Ask a compiler for ideas: compile int64_t neg(int64_t a) { return -a; } in 32-bit mode. Of course, different ways of asking the compiler will have the starting value in memory, in the compiler's choice of registers, or already in EDX:EAX. See all three ways on the Godbolt compiler explorer, with asm output from gcc, clang, and MSVC (aka CL). There