EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FastInt.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int32 int32abs (const int32 value)
 
uint32 int32abs2uint32 (const int32 value)
 
int32 float2int32 (const float value)
 Fastest Method of float2int32. More...
 
int32 double2int32 (const double value)
 Fastest Method of double2int32. More...
 

Function Documentation

int32 double2int32 ( const double  value)
inline

Fastest Method of double2int32.

Definition at line 61 of file FastInt.h.

62 {
63 #ifdef HAVE___ASM
64  int32 i;
65  __asm {
66  fld value
67  frndint
68  fistp i
69  }
70  return i;
71 #else /* !HAVE___ASM */
72  union { int32 asInt[2]; double asDouble; } n;
73  n.asDouble = value + 6755399441055744.0;
74 
75  return n.asInt[0];
76 #endif /* !HAVE___ASM */
77 }
signed __int32 int32
Definition: eve-compat.h:49
int32 float2int32 ( const float  value)
inline

Fastest Method of float2int32.

Definition at line 42 of file FastInt.h.

Referenced by ascent_roundf().

43 {
44 #ifdef HAVE___ASM
45  int32 i;
46  __asm {
47  fld value
48  frndint
49  fistp i
50  }
51  return i;
52 #else /* !HAVE___ASM */
53  union { int32 asInt[2]; double asDouble; } n;
54  n.asDouble = value + 6755399441055744.0;
55 
56  return n.asInt[0];
57 #endif /* !HAVE___ASM */
58 }
signed __int32 int32
Definition: eve-compat.h:49

Here is the caller graph for this function:

int32 int32abs ( const int32  value)
inline

Definition at line 30 of file FastInt.h.

31 {
32  return (value ^ (value >> 31)) - (value >> 31);
33 }
uint32 int32abs2uint32 ( const int32  value)
inline

Definition at line 36 of file FastInt.h.

37 {
38  return (uint32)(value ^ (value >> 31)) - (value >> 31);
39 }
unsigned __int32 uint32
Definition: eve-compat.h:50