Author: jimtabor Date: Thu May 24 05:39:31 2007 New Revision: 26877
URL: http://svn.reactos.org/svn/reactos?rev=26877&view=rev Log: - Fixed arithmetic semantics. Making it more Windows compatible. - This example work now. double F2F(PFLOATOBJ f) { if(SIGN(f->ul1)) // negate mant return (double) -(-f->ul1 * pow(2,(double)f->ul2-32)); else return (double) f->ul1 * pow(2,(double)f->ul2-32); }
Modified: trunk/reactos/dll/win32/gdi32/objects/painting.c trunk/reactos/subsystems/win32/win32k/eng/float.c
Modified: trunk/reactos/dll/win32/gdi32/objects/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/pai... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/painting.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/painting.c Thu May 24 05:39:31 2007 @@ -31,8 +31,9 @@ Sign = SIGN(Mant);
//// M$ storage emulation + if( Sign ) Mant = -Mant; Mant = ((Mant & 0x3fffffff) >> 7); - Exp += (1 - EXCESS); + Exp += (EXCESS-1); //// Mant = MANT(Mant); return PACK(Sign, Exp, Mant); @@ -42,7 +43,7 @@ FASTCALL FtoEF( EFLOAT_S * efp, FLOATL f) { - long Mant, Exp; + long Mant, Exp, Sign = 0; gxf_long worker;
#ifdef _X86_ @@ -53,10 +54,12 @@
Exp = EXP(worker.l); Mant = MANT(worker.l); - + if (SIGN(worker.l)) Sign = -1; //// M$ storage emulation - Mant = ((Mant << 7) | 0x40000000 | SIGN(worker.l)); - Exp -= (1 - EXCESS); + Mant = ((Mant << 7) | 0x40000000); + Mant ^= Sign; + Mant -= Sign; + Exp -= (EXCESS-1); //// efp->lMant = Mant; efp->lExp = Exp;
Modified: trunk/reactos/subsystems/win32/win32k/eng/float.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/float.c (original) +++ trunk/reactos/subsystems/win32/win32k/eng/float.c Thu May 24 05:39:31 2007 @@ -101,9 +101,7 @@ FASTCALL EF_Negate(EFLOAT_S * efp) { -// Do it this way since ReactOS uses real FP. - if (SIGN(efp->lMant)) efp->lMant = efp->lMant & ~SIGNBIT; - else efp->lMant = efp->lMant | SIGNBIT; + efp->lMant = -efp->lMant; }
LONG @@ -119,8 +117,9 @@ Sign = SIGN(Mant);
//// M$ storage emulation - Mant = ((Mant & 0x3fffffff)>>7); - Exp += (1 - EXCESS); + if( Sign ) Mant = -Mant; + Mant = ((Mant & 0x3fffffff) >> 7); + Exp += (EXCESS-1); //// Mant = MANT(Mant); return PACK(Sign, Exp, Mant); @@ -130,7 +129,7 @@ FASTCALL FtoEF( EFLOAT_S * efp, FLOATL f) { - long Mant, Exp; + long Mant, Exp, Sign = 0; gxf_long worker;
#ifdef _X86_ @@ -141,10 +140,12 @@
Exp = EXP(worker.l); Mant = MANT(worker.l); - + if (SIGN(worker.l)) Sign = -1; //// M$ storage emulation - Mant = ((Mant << 7) | 0x40000000 | SIGN(worker.l)); - Exp -= (1 - EXCESS); + Mant = ((Mant << 7) | 0x40000000); + Mant ^= Sign; + Mant -= Sign; + Exp -= (EXCESS-1); //// efp->lMant = Mant; efp->lExp = Exp;