Ziker
Ziker

Reputation: 141

convert C# code to assembly

I have this quite complicated algorithm written in C# and what I need now is to write the same thing in Assembler, I know the basics, but I would really appreciate some clues about app's structure and how to handle matrix in asm. (It's going to be .dll I assume)

Here is the algorithm: http://pastebin.com/iGKcK1rF

Thanks in advance

Upvotes: 1

Views: 6856

Answers (2)

Rahul Banerjee
Rahul Banerjee

Reputation: 2363

To add to Mikhail's answer above:

  1. Profile before you optimize! Look up "gprof". Here's a useful link: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC2

  2. Using the results of profiling, partition your code into compute-intensive inner loops and "outer code".

  3. Convert the inner loops into asm (using Mikhail's suggestion, or some other method) and then call them from your program.

Upvotes: 0

Mikhail Vladimirov
Mikhail Vladimirov

Reputation: 13890

The quickest way is to use your C compiler to generate assembly code from your C code. Then you could study this generated code and improve it. If you are using gcc compiler, launch is with -S option to generate assembly code. If you are using compiler from MS Visual Studio named cl, pass /Fa option to it.

Upvotes: 1

Related Questions