Exetools  

Go Back   Exetools > General > Source Code

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-01-2022, 19:49
chants chants is offline
VIP
 
Join Date: Jul 2016
Posts: 826
Rept. Given: 47
Rept. Rcvd 50 Times in 31 Posts
Thanks Given: 737
Thanks Rcvd at 1,140 Times in 529 Posts
chants Reputation: 51
Lol that is Visual Basic code not C++. So the carrot operator ^ represents exponentiation.

Exponentiation by a positive integer constant is best done by exponentuation by squaring most efficient by finding an addition chain which minimizes the number of multiplications and additions or subtractions. 6=4+2 or 6=8-2 will both work but 4+2 is more efficient

So you use IMUL to multiply by itself once, store the square the multiply the result by itself again, and multiply those together to get the 6th power. Accumulate with ADD and use a counter register initialized to 6 which decreases with DEC each time though the loop and check loop exit condition with jump if zero JZ. This is a very basic assembly task if you've learned it. Addition chains are a more advanced topic if your exponents are huge e.g. in cryptography. There is no known efficient way to find them interestingly enough
Reply With Quote
The Following 2 Users Say Thank You to chants For This Useful Post:
tonyweb (10-02-2022), Zeocrack (10-02-2022)
 

Tags
source co


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 On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VC++ to VS2010 conversion Zeocrack Source Code 11 10-03-2022 17:03
Firmware Analysis - ZLIB file conversion to Bitmap psgama General Discussion 3 08-02-2021 05:03
Anyone can help interpret the algorithm on the data conversion below(ECC related)? bridgeic General Discussion 1 10-01-2014 17:39


All times are GMT +8. The time now is 10:25.


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