X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=ETL%2Ftrunk%2FETL%2F_fixed.h;h=78ed0cdba8e674e29f7796d5049ba5e16df56ae6;hb=8387099a3a9251fa91c9f346c29b340459e64ecc;hp=9233f21118c0ab44c24714bba2ffa9e1aac9c4c3;hpb=36d01e1527fda602a9aed07d209eb34e6770bca8;p=synfig.git diff --git a/ETL/trunk/ETL/_fixed.h b/ETL/trunk/ETL/_fixed.h index 9233f21..78ed0cd 100644 --- a/ETL/trunk/ETL/_fixed.h +++ b/ETL/trunk/ETL/_fixed.h @@ -33,6 +33,10 @@ /* === M A C R O S ========================================================= */ +// the "+0.5" code was commented out - maybe to make thing run faster? +// it can be re-enabled by uncommenting this next line: +// #define ROUND_TO_NEAREST_INTEGER + #ifndef ETL_FIXED_TYPE # define ETL_FIXED_TYPE int #endif @@ -177,16 +181,25 @@ fixed_base::fixed_base(const _fixed &x):_data(x._data) {} template -fixed_base::fixed_base(const float &f):_data(static_cast(f*_ONE()/*+0.5f*/)) -{} +fixed_base::fixed_base(const float &f):_data(static_cast(f*_ONE() +#ifdef ROUND_TO_NEAREST_INTEGER + +0.5f +#endif + )) {} template -fixed_base::fixed_base(const double &f):_data(static_cast(f*_ONE()/*+0.5*/)) -{} +fixed_base::fixed_base(const double &f):_data(static_cast(f*_ONE() +#ifdef ROUND_TO_NEAREST_INTEGER + +0.5 +#endif + )) {} template -fixed_base::fixed_base(const long double &f):_data(static_cast(f*_ONE()/*+0.5*/)) -{} +fixed_base::fixed_base(const long double &f):_data(static_cast(f*_ONE() +#ifdef ROUND_TO_NEAREST_INTEGER + +0.5 +#endif + )) {} template fixed_base::fixed_base(const int &i):_data(i<