Module: Mesa
Branch: main
Commit: 7b7530a85a05edaf8bbfde358cc28d562f48a247
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b7530a85a05edaf8bbfde358cc28d562f48a247

Author: Emma Anholt <[email protected]>
Date:   Tue Jan  4 16:20:28 2022 -0800

r300: Use uif() instead of pointer aliasing in program printing.

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14405>

---

 src/gallium/drivers/r300/compiler/radeon_program_print.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_program_print.c 
b/src/gallium/drivers/r300/compiler/radeon_program_print.c
index 29a349e5da2..10cb9650038 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program_print.c
+++ b/src/gallium/drivers/r300/compiler/radeon_program_print.c
@@ -20,6 +20,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
+#include "util/u_math.h"
 #include "radeon_program.h"
 
 #include <stdio.h>
@@ -115,13 +116,12 @@ static void rc_print_inline_float(FILE * f, int index)
        unsigned r300_mantissa = index & 0x7;
        unsigned float_exponent;
        unsigned real_float;
-       float * print_float = (float*) &real_float;
 
        r300_exponent -= 7;
        float_exponent = r300_exponent + 127;
        real_float = (r300_mantissa << 20) | (float_exponent << 23);
 
-       fprintf(f, "%f (0x%x)", *print_float, index);
+       fprintf(f, "%f (0x%x)", uif(real_float), index);
 
 }
 

Reply via email to