ReactOS 0.4.16-dev-306-g647d351
efloat.c File Reference
#include <precomp.h>
Include dependency graph for efloat.c:

Go to the source code of this file.

Macros

#define EXCESS   126L
 
#define SIGNBIT   0x80000000L
 
#define SIGN(fp)   ((fp) & SIGNBIT)
 
#define EXP(fp)   (((fp) >> 23L) & 0xFF)
 
#define MANT(fp)   ((fp) & 0x7FFFFFL)
 
#define PACK(s, e, m)   ((s) | ((e) << 23L) | (m))
 

Functions

FLOATL FASTCALL EFtoF (EFLOAT_S *efp)
 
VOID FASTCALL FtoEF (EFLOAT_S *efp, FLOATL f)
 

Macro Definition Documentation

◆ EXCESS

#define EXCESS   126L

Definition at line 11 of file efloat.c.

◆ EXP

#define EXP (   fp)    (((fp) >> 23L) & 0xFF)

Definition at line 14 of file efloat.c.

◆ MANT

#define MANT (   fp)    ((fp) & 0x7FFFFFL)

Definition at line 15 of file efloat.c.

◆ PACK

#define PACK (   s,
  e,
  m 
)    ((s) | ((e) << 23L) | (m))

Definition at line 16 of file efloat.c.

◆ SIGN

#define SIGN (   fp)    ((fp) & SIGNBIT)

Definition at line 13 of file efloat.c.

◆ SIGNBIT

#define SIGNBIT   0x80000000L

Definition at line 12 of file efloat.c.

Function Documentation

◆ EFtoF()

FLOATL FASTCALL EFtoF ( EFLOAT_S efp)

Definition at line 20 of file efloat.c.

21{
22 ULONG Mant, Exp, Sign;
23
24 if (!efp->lMant) return 0;
25
26 Mant = efp->lMant;
27 Exp = efp->lExp;
28 Sign = SIGN(Mant);
29
30 if (Sign) Mant = -(LONG)Mant;
31 Mant >>= 7;
32 Exp += (EXCESS-1);
33
34 Mant = MANT(Mant);
35 return PACK(Sign, Exp, Mant);
36}
@ Sign
Definition: msg.c:1064
#define SIGN(fp)
Definition: efloat.c:13
#define EXCESS
Definition: efloat.c:11
#define MANT(fp)
Definition: efloat.c:15
#define PACK(s, e, m)
Definition: efloat.c:16
long LONG
Definition: pedump.c:60
LONG lExp
Definition: ntgdityp.h:393
LONG lMant
Definition: ntgdityp.h:392
uint32_t ULONG
Definition: typedefs.h:59

◆ FtoEF()

VOID FASTCALL FtoEF ( EFLOAT_S efp,
FLOATL  f 
)

Definition at line 40 of file efloat.c.

41{
42 ULONG Mant, Exp, Sign = 0;
43 gxf_long worker;
44
45#ifdef _X86_
46 worker.l = f; // It's a float stored in a long.
47#else
48 worker.f = f;
49#endif
50
51 Exp = EXP(worker.l);
52 Mant = MANT(worker.l);
53 if (SIGN(worker.l)) Sign = -1;
54
55 Mant = ((Mant << 7) | 0x40000000);
56 Mant ^= Sign;
57 Mant -= Sign;
58 Exp -= (EXCESS-1);
59
60 efp->lMant = Mant;
61 efp->lExp = Exp;
62}
#define EXP(fp)
Definition: efloat.c:14
#define f
Definition: ke_i.h:83
ULONG l
Definition: ntgdityp.h:427
FLOAT f
Definition: ntgdityp.h:426