Overhead hit for fit vs. fit01?

   2054   1   0
User Avatar
Member
100 posts
Joined: April 2014
Offline
Since fit01 automatically assumes the 0 - 1 omin/omax, would it be any faster or slower than using fit and specifying 0 - 1 as the original min/max? I'm just curious if there is a speed/processing-demands reason to use one over the other, or if it is just a convenience.
User Avatar
Staff
6189 posts
Joined: July 2005
Offline
In VEX:
#define CREATE_FIT01(TYPE) \
TYPE fit01(const TYPE val; const TYPE nmin; const TYPE nmax) \
{ \
    return fit(val, TYPE(0), TYPE(1), nmin, nmax); \
}

CREATE_FIT01(float)
CREATE_FIT01(vector2)
CREATE_FIT01(vector)
CREATE_FIT01(vector4)
#undef CREATE_FIT01

In the EXPR world (expressions outside of VEX)

EV_START_FN(fn_fit01)
{
    fpreal val = SYSfit(argv[0]->value.fval, 0, 1,
                      argv[1]->value.fval, argv[2]->value.fval);
    EV_END_FN(val);
}


So it is just convenience.
  • Quick Links