From 7c79d2ce8081b41f24e64ceb73e29025ab39534b Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 30 Sep 2014 04:16:35 +0000 Subject: [PATCH] Blrintf git-svn-id: https://svn.eduke32.com/eduke32@4632 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/compat.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 4e882667c..e72f9ca36 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -168,8 +168,24 @@ static inline long lround(double num) return (long) (num > 0 ? num + 0.5 : ceil(num - 0.5)); } +#if defined(_WIN64) +#include +static inline int32_t Blrintf(const float x) +{ + __m128 xx = _mm_load_ss(&x); + return _mm_cvtss_si32(xx); +} +#else +static inline int32_t Blrintf(const float x) +{ + int n; + __asm fld x; + __asm fistp n; +} return n; +#endif #else # define longlong(x) x##ll +#define Blrintf lrintf #endif #if defined __OPENDINGUX__