forked from enlightenment/efl
ector software - fix min/max int range for fixedpoint math
min value bitshifts are negative and thus not portable. just tax max (as its 1 more than min it if we do -max) as the limit as its within range. this should fix it @fix found by PVS studio
This commit is contained in:
parent
29eebb44fc
commit
2b91a48d72
|
@ -408,8 +408,11 @@ fetch_linear_gradient(uint32_t *buffer, Span_Data *data, int y, int x, int lengt
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (t + inc*length < (float)(INT_MAX >> (FIXPT_BITS + 1)) &&
|
const int vmax = INT_MAX >> (FIXPT_BITS + 1);
|
||||||
t+inc*length > (float)(INT_MIN >> (FIXPT_BITS + 1)))
|
const int vmin = -vmin;
|
||||||
|
float v = t + (inc *length);
|
||||||
|
|
||||||
|
if ((v < (float)vmax) && (v > (float)(vmin)))
|
||||||
{
|
{
|
||||||
// we can use fixed point math
|
// we can use fixed point math
|
||||||
t_fixed = (int)(t * FIXPT_SIZE);
|
t_fixed = (int)(t * FIXPT_SIZE);
|
||||||
|
|
Loading…
Reference in New Issue