How would I go about converting ASM to PHP?
There is a program I would like to understand a bit more of, but most of it is in ASM. MatrixMult开发者_StackOverflow社区iply
The reference page is here.
I understand C++, but the ASM part is a bit vague. Can someone explain?
This program uses SIMD (i.e. SSE) instructions to optimize matrix multiplication. There is no sense in thinking of a way to convert this to PHP, as it is an interpreted language - you don't have access to the CPU in that way, heck, PHP might run on a CPU who does not even provide these instructions.
If you want to do this in PHP, you can either create a simple, non-optimized routine for matrix multiplication or develop an extension. In the latter case, I'd suggest using one of the canonical BLAS implementations, though, instead of some random code snippet from the web. See http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms
The search keyword you are looking for is decompiler
. AFAIK, You may not be able to convert x86 assembly to PHP decompiler because no one might not found need for it.
If your purpose is to understand the assembly code. There are lot of decompilers for C. You can understand reading the C code.
There is a PHP port of the JAMA standard matrix class for Java over on PHPMath, which provides a suite of methods for martix addition, subtraction, multiplication, division, transform, etc. It's coded in PHP4, but doesn't take a lot of work to convert to PHP5.
While not directly answering your question about ASM to PHP, it may be useful to give you a ready-built PHP MatrixMultiply
精彩评论