Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-19-2017, 09:05
atom0s's Avatar
atom0s atom0s is offline
Family
 
Join Date: Jan 2015
Location: 127.0.0.1
Posts: 431
Rept. Given: 26
Rept. Rcvd 130 Times in 67 Posts
Thanks Given: 54
Thanks Rcvd at 837 Times in 306 Posts
atom0s Reputation: 100-199 atom0s Reputation: 100-199
Using modern compiler optimizations it suggests that doing something like this:
Code:
    int32_t val1 = 1234;
    int32_t val2 = -val1;
Translates to:
Code:
mov     [ebp+var_4], 4D2h
mov     eax, [ebp+var_4]
neg     eax
mov     [ebp+var_4], eax
which is what mcp suggested in his first suggestion. If you write the code out as:
Code:
int32_t val1 = 1234;
val1 *= -1;
It also optimizes to the first suggestion.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hex-Rays and negative structure offsets jonwil General Discussion 3 02-20-2019 10:37


All times are GMT +8. The time now is 23:53.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )