Author: gschneider Date: Mon Apr 6 01:27:39 2009 New Revision: 40378
URL: http://svn.reactos.org/svn/reactos?rev=40378&view=rev Log: - msvcrt's pow function does not set errno, so there is no need for a hard coded breakpoint, jump labels adjusted accordingly - Allows oleaut32_winetest vartest to finish
Modified: trunk/reactos/lib/sdk/crt/math/i386/pow_asm.s
Modified: trunk/reactos/lib/sdk/crt/math/i386/pow_asm.s URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/pow_a... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/i386/pow_asm.s [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/i386/pow_asm.s [iso-8859-1] Mon Apr 6 01:27:39 2009 @@ -65,7 +65,7 @@ or ah,al // Set new CF, PF and ZF sahf // Store AH into Flags jb __fpow1 // Re-direct if x < 0 - ja __fpow3 // Re-direct if x > 0 + ja __fpow2 // Re-direct if x > 0 fxch // Swap st, st(1) fcom qword ptr [edi] // Compare y with zero fxch // Restore x as top of stack @@ -76,10 +76,8 @@ and ah, 0b10111010 // Turn off CF, PF and ZF or ah,al // Set new CF, PF and ZF sahf // Store AH into Flags - ja __fpow3 // Re-direct if y > 0 - fstp st(1) // Set new stack top and pop - mov eax,1 // Set domain error (EDOM) - jmp __fpow5 // End of case + ja __fpow2 // Re-direct if y > 0 + jmp __fpow4 // End of case __fpow1: fxch // Put y on top of stack fld st // Duplicate y as st(1) frndint // Round to integer @@ -92,17 +90,12 @@ and ah, 0b10111010 // Turn off CF, PF and ZF or ah,al // Set new CF, PF and ZF sahf // Store AH into Flags - je __fpow2 // Proceed if y = int(y) - fstp st(1) // Set new stack top and pop - fldz // Set result to zero - fstp st(1) // Set new stack top and pop - mov eax,1 // Set domain error (EDOM) - jmp __fpow5 // End of case -__fpow2: fist dword ptr [ebp-12] // Store y as integer + jne __fpow4 // Proceed if y = int(y) + fist dword ptr [ebp-12] // Store y as integer and dword ptr [ebp-12],1 // Set bit if y is odd fxch // Put x on top of stack fabs // x = |x| -__fpow3: fldln2 // Load log base e of 2 +__fpow2: fldln2 // Load log base e of 2 fxch st(1) // Exchange st, st(1) fyl2x // Compute the natural log(x) fmulp // Compute y * ln(x) @@ -118,21 +111,11 @@ fscale // Scale by power of 2 fstp st(1) // Set new stack top and pop test dword ptr [ebp-12],1 // Negation required ? - jz __fpow4 // No, re-direct + jz __fpow3 // No, re-direct fchs // Negate the result -__fpow4: fstp qword ptr [ebp-8] // Save (double)pow(x, y) +__fpow3: fstp qword ptr [ebp-8] // Save (double)pow(x, y) fld qword ptr [ebp-8] // Load (double)pow(x, y) - fxam // Examine st - fstsw ax // Get the FPU status word - cmp ah,5 // Infinity ? - jne __fpow6 // No, end of case - mov eax,2 // Set range error (ERANGE) - // Get errno pointer offset -__fpow5: int 3 - mov edi,0 // TODO: offset flat:__crt_errno - mov edi,[edi] // Get C errno variable pointer - mov dword ptr [edi],eax // Set errno -__fpow6: pop eax // Restore register eax +__fpow4: pop eax // Restore register eax pop edi // Restore register edi mov esp,ebp // Deallocate temporary space pop ebp