Thread
:
Multiply by negative one
View Single Post
#
2
01-19-2017, 08:23
mcp
Friend
Join Date: Dec 2011
Posts: 73
Rept. Given: 4
Rept. Rcvd 12 Times in 11 Posts
Thanks Given: 7
Thanks Rcvd at 47 Times in 35 Posts
You can move the value to a register and use NEG on it (assuming x86, 32 bit):
Code:
mov eax, [val] neg eax mov [val], eax
Alternatively, subtract from zero:
Code:
xor exc, ecx mov eax, [val] sub ecx, eax mov [val], ecx
The Following User Says Thank You to mcp For This Useful Post:
chants
 (01-19-2017)
mcp
View Public Profile
Find all posts by mcp