* follows:
*
* packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
- *
- * We must first cast the float to an int, because casting a negative
- * float to a uint is undefined.
*/
- return (uint8_t) (int)
- _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
+ return (uint8_t)
+ _mesa_lroundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
}
/**
* follows:
*
* packSnorm2x16: round(clamp(c, -1, +1) * 32767.0)
- *
- * We must first cast the float to an int, because casting a negative
- * float to a uint is undefined.
*/
- return (uint16_t) (int)
- _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
+ return (uint16_t)
+ _mesa_lroundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
}
/**
* or normal.
*/
e = 0;
- m = (int) _mesa_roundevenf((1 << 24) * fabsf(fi.f));
+ m = _mesa_lroundevenf((1 << 24) * fabsf(fi.f));
}
else if (new_exp > 15) {
/* map this value to infinity */
* either normal or infinite.
*/
e = new_exp + 15;
- m = (int) _mesa_roundevenf(flt_m / (float) (1 << 13));
+ m = _mesa_lroundevenf(flt_m / (float) (1 << 13));
}
}