ReactOS 0.4.15-dev-8100-g1887773
__fto64.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  _FTO64_UNION
 

Macros

#define FRACTION_LEN   23
 
#define EXPONENT_LEN   8
 
#define SIGN_MASK   (((FINT_TYPE)1) << (FRACTION_LEN + EXPONENT_LEN))
 
#define FRACTION_ONE   (((FINT_TYPE)1) << FRACTION_LEN)
 
#define FRACTION_MASK   ((FRACTION_ONE) - 1)
 
#define EXPONENT_MASK   ((1 << EXPONENT_LEN) - 1)
 
#define EXPONENT_ZERO   ((1 << (EXPONENT_LEN - 1)) - 1)
 
#define EXPONENT_MAX   63
 
#define INTNAN   0xFFFFFFFFFFFFFFFFULL
 
#define EXPONENT_INFINITY   EXPONENT_MASK
 
#define NEGATE(x)   (~(x) + 1)
 

Typedefs

typedef float FLOAT_TYPE
 
typedef unsigned int FINT_TYPE
 
typedef unsigned long long FTO64_RESULT
 
typedef union _FTO64_UNION FTO64_UNION
 

Functions

FTO64_RESULT __fto64 (FLOAT_TYPE fvalue)
 

Macro Definition Documentation

◆ EXPONENT_INFINITY

#define EXPONENT_INFINITY   EXPONENT_MASK

Definition at line 48 of file __fto64.h.

◆ EXPONENT_LEN

#define EXPONENT_LEN   8

Definition at line 17 of file __fto64.h.

◆ EXPONENT_MASK

#define EXPONENT_MASK   ((1 << EXPONENT_LEN) - 1)

Definition at line 37 of file __fto64.h.

◆ EXPONENT_MAX

#define EXPONENT_MAX   63

Definition at line 44 of file __fto64.h.

◆ EXPONENT_ZERO

#define EXPONENT_ZERO   ((1 << (EXPONENT_LEN - 1)) - 1)

Definition at line 38 of file __fto64.h.

◆ FRACTION_LEN

#define FRACTION_LEN   23

Definition at line 16 of file __fto64.h.

◆ FRACTION_MASK

#define FRACTION_MASK   ((FRACTION_ONE) - 1)

Definition at line 35 of file __fto64.h.

◆ FRACTION_ONE

#define FRACTION_ONE   (((FINT_TYPE)1) << FRACTION_LEN)

Definition at line 34 of file __fto64.h.

◆ INTNAN

#define INTNAN   0xFFFFFFFFFFFFFFFFULL

Definition at line 45 of file __fto64.h.

◆ NEGATE

#define NEGATE (   x)    (~(x) + 1)

Definition at line 50 of file __fto64.h.

◆ SIGN_MASK

#define SIGN_MASK   (((FINT_TYPE)1) << (FRACTION_LEN + EXPONENT_LEN))

Definition at line 32 of file __fto64.h.

Typedef Documentation

◆ FINT_TYPE

Definition at line 15 of file __fto64.h.

◆ FLOAT_TYPE

typedef float FLOAT_TYPE

Definition at line 14 of file __fto64.h.

◆ FTO64_RESULT

Definition at line 24 of file __fto64.h.

◆ FTO64_UNION

typedef union _FTO64_UNION FTO64_UNION

Function Documentation

◆ __fto64()

FTO64_RESULT __fto64 ( FLOAT_TYPE  fvalue)

Definition at line 53 of file __fto64.h.

54{
55 FTO64_UNION u = { .value = fvalue };
56 FINT_TYPE value = u.raw;
57 int exponent;
58 FTO64_RESULT fraction;
59
60 exponent = (int)(value >> FRACTION_LEN);
61 exponent &= EXPONENT_MASK;
62
63 /* infinity and other NaNs */
64 if (exponent == EXPONENT_INFINITY)
65 return INTNAN;
66
67 /* subnormals and signed zeros */
68 if (exponent == 0)
69 return 0;
70
71 exponent -= EXPONENT_ZERO;
72
73 /* number is less then one */
74 if (exponent < 0)
75 return 0;
76
77 /* number is too big */
78 if (exponent > EXPONENT_MAX)
79 return INTNAN;
80
81#ifndef _USE_SIGNED_
82 if (value & SIGN_MASK)
83 return INTNAN;
84#endif
85
86 fraction = value & FRACTION_MASK;
87 fraction |= FRACTION_ONE;
88
89 exponent -= FRACTION_LEN;
90 if (exponent != 0)
91 {
92 if (exponent < 0)
93 fraction = fraction >> NEGATE(exponent);
94 else
95 fraction = fraction << exponent;
96 }
97
98#ifdef _USE_SIGNED_
99 if (value & SIGN_MASK)
100 fraction = NEGATE(fraction);
101#endif
102
103 return fraction;
104}
unsigned int FINT_TYPE
Definition: __64tof.h:16
#define NEGATE(x)
Definition: __fto64.h:50
#define EXPONENT_INFINITY
Definition: __fto64.h:48
#define FRACTION_ONE
Definition: __fto64.h:34
unsigned long long FTO64_RESULT
Definition: __fto64.h:24
#define FRACTION_LEN
Definition: __fto64.h:16
#define INTNAN
Definition: __fto64.h:45
#define SIGN_MASK
Definition: __fto64.h:32
#define EXPONENT_ZERO
Definition: __fto64.h:38
#define EXPONENT_MAX
Definition: __fto64.h:44
#define FRACTION_MASK
Definition: __fto64.h:35
#define EXPONENT_MASK
Definition: __fto64.h:37
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
Definition: pdh_main.c:94