Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline float __declspec(naked) __fastcall Sin(float angle) {
- _asm {
- fld dword ptr[esp+4]
- fmul dword ptr[ToRadians]
- fsin
- ret 4
- }
- }
- //...
- float f = 0.0f;
- float angle = 0.0f;
- BEGIN_PROFILE("StdSin");
- for(int i = 0; i < tests; i++) {
- f *= std::sin(angle * ToRadians);
- angle ++;
- }
- END_PROFILE("StdSin");
- angle = 0.0f;
- BEGIN_PROFILE("MySin");
- for(int j = 0; j < tests; j++) {
- f *= Sin(angle);
- angle ++;
- }
- END_PROFILE("MySin");
- angle = 0.0f;
- double t1 = Profiling->FindProfilerInfo("StdSin").AvgTime; //65
- double t2 = Profiling->FindProfilerInfo("MySin").AvgTime; //35
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement