src/conversions-inl.h
static inline int FastD2I(double x) {
#ifdef __USE_ISOC99
  // The ISO C99 standard defines the lrint() function which rounds a
  // double to an integer according to the current rounding direction.
  return lrint(x);
#else
  // This is incredibly slow on Intel x86. The reason is that rounding
  // towards zero is implied by the C standard. This means that the
  // status register of the FPU has to be changed with the 'fldcw'
  // instruction. This completely stalls the pipeline and takes many
  // hundreds of clock cycles.
  return static_cast<int>(x);
#endif
}
// The fast double-to-int conversion routine does not guarantee
// rounding towards zero.
The fast double-to-int conversion routine does not guarantee
rounding towards zero.
The fast double - to - int conversion routine does not guarantee rounding towards zero .
static inline int FastD2I(double x) {
#ifdef __USE_ISOC99
  return lrint(x);
#else
  return static_cast<int>(x);
#endif
}
static inline int FastD2I ( double x ) { #ifdef __USE_ISOC99 return lrint ( x ) ; #else return static_cast < int > ( x ) ; #endif }
The fast double-to-int conversion routine does not guarantee
rounding towards zero.
The fast double - to - int conversion routine does not guarantee rounding towards zero .
// The ISO C99 standard defines the lrint() function which rounds a // double to an integer according to the current rounding direction. // This is incredibly slow on Intel x86. The reason is that rounding // towards zero is implied by the C standard. This means that the // status register of the FPU has to be changed with the 'fldcw' // instruction. This completely stalls the pipeline and takes many // hundreds of clock cycles.