From 24ae7c4c1f18c3086a779a2ee8f480ee5f4e7612 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 Jun 2001 15:22:07 +0000 Subject: Added fi_type union typedef to glheader.h. Replace various float/int casts with the fi_type union cast. Fixes -fstrict-aliasing problems. --- src/mesa/main/glheader.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/glheader.h') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 0324b42ffd..596bd2d01e 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -1,4 +1,4 @@ -/* $Id: glheader.h,v 1.20 2001/05/14 23:11:12 brianp Exp $ */ +/* $Id: glheader.h,v 1.21 2001/06/15 15:22:07 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -241,5 +241,15 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #endif +/* + * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float + * as a int (thereby using integer registers instead of fp registers) is + * a performance win. Typically, this can be done with ordinary casts. + * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) + * these casts generate warnings. + * The following union typedef is used to solve that. + */ +typedef union { GLfloat f; GLint i; } fi_type; + #endif /* GLHEADER_H */ -- cgit v1.2.3