#include "vector.h"
#include "angle.h"
#include "real.h"
+#include <ETL/misc>
#endif
case ValueBase::TYPE_COLOR:
return ((*ref_a)(t).get(Color())+(*ref_b)(t).get(Color()))*(*scalar)(t).get(Real());
case ValueBase::TYPE_INTEGER:
- {
- Real ret = ((*ref_a)(t).get(int())+(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()) + 0.5f;
- if (ret < 0) return static_cast<int>(ret-1);
- return static_cast<int>(ret);
- }
+ return round_to_int(((*ref_a)(t).get(int())+(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()));
case ValueBase::TYPE_REAL:
return ((*ref_a)(t).get(Vector::value_type())+(*ref_b)(t).get(Vector::value_type()))*(*scalar)(t).get(Real());
case ValueBase::TYPE_TIME:
#include "valuenode_const.h"
#include "general.h"
#include "color.h"
+#include <ETL/misc>
#endif
case ValueBase::TYPE_COLOR:
return (*m_)(t).get( Color())*t+(*b_)(t).get( Color());
case ValueBase::TYPE_INTEGER:
- {
- Real ret = (*m_)(t).get(int())*t+(*b_)(t).get(int()) + 0.5f;
- if (ret < 0) return static_cast<int>(ret-1);
- return static_cast<int>(ret);
- }
+ return round_to_int((*m_)(t).get(int())*t+(*b_)(t).get(int()));
case ValueBase::TYPE_REAL:
return (*m_)(t).get( Real())*t+(*b_)(t).get( Real());
case ValueBase::TYPE_TIME:
#include "vector.h"
#include "time.h"
#include "angle.h"
+#include <ETL/misc>
#endif
return ret;
}
else if(get_type()==ValueBase::TYPE_INTEGER)
- {
- Real ret = (*value_node)(t).get(int())*(*scalar)(t).get(Real()) + 0.5f;
- if (ret < 0) return static_cast<int>(ret-1);
- return static_cast<int>(ret);
- }
+ return round_to_int((*value_node)(t).get(int())*(*scalar)(t).get(Real()));
else if(get_type()==ValueBase::TYPE_REAL)
return (*value_node)(t).get(Real())*(*scalar)(t).get(Real());
else if(get_type()==ValueBase::TYPE_TIME)
#include "vector.h"
#include "angle.h"
#include "real.h"
+#include <ETL/misc>
#endif
case ValueBase::TYPE_COLOR:
return ((*ref_a)(t).get(Color())-(*ref_b)(t).get(Color()))*(*scalar)(t).get(Real());
case ValueBase::TYPE_INTEGER:
- {
- Real ret = ((*ref_a)(t).get(int())-(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()) + 0.5f;
- if (ret < 0) return static_cast<int>(ret-1);
- return static_cast<int>(ret);
- }
+ return round_to_int(((*ref_a)(t).get(int())-(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()));
case ValueBase::TYPE_REAL:
return ((*ref_a)(t).get(Vector::value_type())-(*ref_b)(t).get(Vector::value_type()))*(*scalar)(t).get(Real());
case ValueBase::TYPE_TIME:
#include "valuenode_const.h"
#include <stdexcept>
#include "color.h"
+#include <ETL/misc>
#endif
{
float a=(float)(*after)(t).get(int());
float b=(float)(*before)(t).get(int());
- return static_cast<int>((b-a)*amount+a+0.5f);
+ return round_to_int((b-a)*amount+a);
}
case ValueBase::TYPE_REAL:
{