Hmp files are not written correctly when compiler optimization is used. This probably has to do with compression of constant data types by the optimizations. I don't think that my patch is the optimal solution to this problem, but it shows where the problem is and how it can be fixed. With this patch hmp files work at least. One obvious problem is that little/big endianess is not taken into account in my solution.
You have fixed syntax errors that would break the compilation of D2X-XL on Linux. That compilation works for me though. I wonder whether the hmp stuff is used at all.
The proper way to handle this was to make sure BE_INT(<constant>) works as intended. Your solution is an ugly architecture dependent hack.
Your version of hmpfile.cpp is not the current one. Are you using the SVN repo or the source rar file? Linux users should use the repo (I regularly tag releases).
This patch applies cleanly against the current svn code. I mentioned above that it was an architectural specific and unclean method of fixing it. The problem is that the BE_INT (<constant>) method doesn't work. I think that when the -O3 compiler optimization flag is used the compiler takes the BE_INT inline code and sees that it is evaluating on a constant and evaluates the code at compile time. Perhaps all that is needed is for the BE_INT not to be declared inline. I will test that.
Do you realize that you have two hmpfile.cpp files? One in audio/linux/ and one in audio/win32. I noticed that after I posted this patch you made a few changes to audio/win32/hmpfile.cpp. That file is not used in linux, at least not with the way your make files are currently set up. I have tried changing the code in audio/linux/hmpfile.cpp to mirror the changes in win32/hmpfile.cpp and those changes you recently made do not fix the problem at all.