deepstone
diff src/fixedp.h @ 40:1fa939507d8b
fast floating point->int conversion
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 15 Sep 2017 05:00:37 +0300 |
parents | dcfe615c4c5f |
children |
line diff
1.1 --- a/src/fixedp.h Mon Mar 10 17:28:28 2014 +0200 1.2 +++ b/src/fixedp.h Fri Sep 15 05:00:37 2017 +0300 1.3 @@ -31,6 +31,12 @@ 1.4 extern const fixed fixed_tenth; 1.5 extern const fixed fixed_255;*/ 1.6 1.7 +static __inline long cround64(double val) 1.8 +{ 1.9 + val += 6755399441055744.0; 1.10 + return *(long*)&val; 1.11 +} 1.12 + 1.13 #ifdef DBG_USE_FLOAT 1.14 /* ------- debug mode, use floating point -------- */ 1.15 #define FIXED_INT_PART(n) ((int)(n))