ReactOS
0.4.16-dev-329-g9223134
efloat.c
Go to the documentation of this file.
1
/*
2
* COPYRIGHT: See COPYING in the top level directory
3
* PROJECT: ReactOS System Libraries
4
* FILE: win32ss/gdi/gdi32/objects/efloat.c
5
* PURPOSE: Functions to convert between FLOAT and EFLOAT
6
* PROGRAMMER: James Tabor
7
*/
8
#include <precomp.h>
9
10
/* the following deal with IEEE single-precision numbers */
11
#define EXCESS 126L
12
#define SIGNBIT 0x80000000L
13
#define SIGN(fp) ((fp) & SIGNBIT)
14
#define EXP(fp) (((fp) >> 23L) & 0xFF)
15
#define MANT(fp) ((fp) & 0x7FFFFFL)
16
#define PACK(s,e,m) ((s) | ((e) << 23L) | (m))
17
18
FLOATL
19
FASTCALL
20
EFtoF
(
EFLOAT_S
* efp)
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
}
37
38
VOID
39
FASTCALL
40
FtoEF
(
EFLOAT_S
* efp,
FLOATL
f
)
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
}
Sign
@ Sign
Definition:
msg.c:1064
SIGN
#define SIGN(fp)
Definition:
efloat.c:13
EXP
#define EXP(fp)
Definition:
efloat.c:14
EFtoF
FLOATL FASTCALL EFtoF(EFLOAT_S *efp)
Definition:
efloat.c:20
EXCESS
#define EXCESS
Definition:
efloat.c:11
MANT
#define MANT(fp)
Definition:
efloat.c:15
FtoEF
VOID FASTCALL FtoEF(EFLOAT_S *efp, FLOATL f)
Definition:
efloat.c:40
PACK
#define PACK(s, e, m)
Definition:
efloat.c:16
f
GLfloat f
Definition:
glext.h:7540
void
Definition:
nsiface.idl:2307
f
#define f
Definition:
ke_i.h:83
FASTCALL
#define FASTCALL
Definition:
nt_native.h:50
LONG
long LONG
Definition:
pedump.c:60
_EFLOAT_S
Definition:
ntgdityp.h:391
_EFLOAT_S::lExp
LONG lExp
Definition:
ntgdityp.h:393
_EFLOAT_S::lMant
LONG lMant
Definition:
ntgdityp.h:392
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
gxf_long
Definition:
ntgdityp.h:425
gxf_long::l
ULONG l
Definition:
ntgdityp.h:427
gxf_long::f
FLOAT f
Definition:
ntgdityp.h:426
FLOATL
FLOAT FLOATL
Definition:
winddi.h:114
win32ss
gdi
gdi32
objects
efloat.c
Generated on Sat Dec 7 2024 06:14:54 for ReactOS by
1.9.6