mesa: Fix clamping to -1.0 in snorm_to_float
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Aug 2014 15:36:46 +0000 (08:36 -0700)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 12 Jan 2015 10:20:27 +0000 (11:20 +0100)
commit7d1b08ac44cf2531b0df39f52ead93ad216ea233
tree6837fd095a0d47e401c2aa35b8bc8462a95d21db
parent3b5f2064757cc99a985420ea43805b8a39a33eb0
mesa: Fix clamping to -1.0 in snorm_to_float

This patch fixes the return of a wrong value when x is lower than
-MAX_INT(src_bits) as the result would not be between [-1.0 1.0].

v2 by Samuel Iglesias <siglesias@igalia.com>:
    - Modify snorm_to_float() to avoid doing the division when
      x == -MAX_INT(src_bits)

Cc: 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/main/format_utils.c