From: Yonggang Luo Date: Wed, 21 Dec 2022 16:46:34 +0000 (+0800) Subject: util: Implement util_iround with lrintf unconditionally X-Git-Tag: upstream/23.3.3~13727 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1a33789b8aa6cdfe7611e54167ec64d0b1dad3d;p=platform%2Fupstream%2Fmesa.git util: Implement util_iround with lrintf unconditionally Because the place that called util_iround are always ensured that INT_MIN <= f <= INT_MAX Signed-off-by: Yonggang Luo Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/gallium/drivers/virgl/ci/traces-virgl.yml b/src/gallium/drivers/virgl/ci/traces-virgl.yml index 9d942d2..8c0d980 100644 --- a/src/gallium/drivers/virgl/ci/traces-virgl.yml +++ b/src/gallium/drivers/virgl/ci/traces-virgl.yml @@ -36,7 +36,7 @@ traces: checksum: aef0b32ce99a3b25d35304ca08032833 gputest/plot3d-v2.trace: gl-virgl: - checksum: 817a36e53edccdf946061315596e9cdd + checksum: 96f9fdf530e6041a4f56762b8378f22e gputest/tessmark-v2.trace: gl-virgl: label: [skip, slow] diff --git a/src/util/u_math.h b/src/util/u_math.h index 23116ce..bb639f4 100644 --- a/src/util/u_math.h +++ b/src/util/u_math.h @@ -155,27 +155,12 @@ util_ifloor(float f) /** * Round float to nearest int. + * the range of f should be [INT_MIN, INT_MAX] */ static inline int util_iround(float f) { -#if DETECT_CC_GCC && DETECT_ARCH_X86 - int r; - __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); - return r; -#elif DETECT_CC_MSVC && DETECT_ARCH_X86 - int r; - _asm { - fld f - fistp r - } - return r; -#else - if (f >= 0.0f) - return (int) (f + 0.5f); - else - return (int) (f - 0.5f); -#endif + return (int)lrintf(f); }