OSDN Git Service

mesa: reimplement IROUND(), add F_TO_I()
authorBrian Paul <brianp@vmware.com>
Fri, 18 May 2012 20:39:41 +0000 (14:39 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 19 May 2012 14:28:57 +0000 (08:28 -0600)
commit699c1894eea6a42a747ebbc3974bf0abf3d1dd88
treeac60a35e6c92598564df7134804ada1bf5d1a1fc
parent31d59c78f01925c199fd3a49a27718b0659bbaf4
mesa: reimplement IROUND(), add F_TO_I()

The different implementations of IROUND() behaved differently and in
the case of fistp, depended on the current x86 FPU rounding mode.
This caused some tests like piglit roundmode-pixelstore and
roundmode-getintegerv to fail on 32-bit x86 but pass on 64-bit x86.

Now IROUND() always rounds to the nearest integer (away from zero).
The new F_TO_I function converts a float to an int by whatever means
is fastest.  We'll use this where we're more concerned with performance
and not too worried to how the conversion is done.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/mesa/main/imports.h