ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

efloat.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         ReactOS System Libraries
00004  * FILE:            dll/gdi32/objects/coord.c
00005  * PURPOSE:         Functions to convert between FLOAT and EFLOAT
00006  * PROGRAMMER:      James Tabor
00007  */
00008 #include "precomp.h"
00009 
00010 /* the following deal with IEEE single-precision numbers */
00011 #define EXCESS          126L
00012 #define SIGNBIT         0x80000000L
00013 #define SIGN(fp)        ((fp) & SIGNBIT)
00014 #define EXP(fp)         (((fp) >> 23L) & 0xFF)
00015 #define MANT(fp)        ((fp) & 0x7FFFFFL)
00016 #define PACK(s,e,m)     ((s) | ((e) << 23L) | (m))
00017 
00018 FLOATL
00019 FASTCALL
00020 EFtoF(EFLOAT_S * efp)
00021 {
00022     ULONG Mant, Exp, Sign;
00023 
00024     if (!efp->lMant) return 0;
00025 
00026     Mant = efp->lMant;
00027     Exp = efp->lExp;
00028     Sign = SIGN(Mant);
00029 
00030     if (Sign) Mant = -Mant;
00031     Mant >>= 7;
00032     Exp += (EXCESS-1);
00033 
00034     Mant = MANT(Mant);
00035     return PACK(Sign, Exp, Mant);
00036 }
00037 
00038 VOID
00039 FASTCALL
00040 FtoEF( EFLOAT_S * efp, FLOATL f)
00041 {
00042     ULONG Mant, Exp, Sign = 0;
00043     gxf_long worker;
00044 
00045 #ifdef _X86_
00046     worker.l = f; // It's a float stored in a long.
00047 #else
00048     worker.f = f;
00049 #endif
00050 
00051     Exp = EXP(worker.l);
00052     Mant = MANT(worker.l);
00053     if (SIGN(worker.l)) Sign = -1;
00054 
00055     Mant = ((Mant << 7) | 0x40000000);
00056     Mant ^= Sign;
00057     Mant -= Sign;
00058     Exp -= (EXCESS-1);
00059 
00060     efp->lMant = Mant;
00061     efp->lExp = Exp;
00062 }

Generated on Sat May 26 2012 04:37:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.