aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gray <[email protected]>2014-11-29 19:00:51 +1100
committerMatt Turner <[email protected]>2014-12-01 16:13:08 -0800
commit31a46fb7a5063b7d292acbefb89138ee25b2673e (patch)
tree70f3bde98a0aa183d33dd6dea687048d4dea8292
parent991d5cf8ce5c7842801fdb0378bf5aca5a59cc4c (diff)
i965: avoid anonymous struct in float <-> VF conversions
Anonymous structures are only supported with newer versions of GCC. They will not work with GCC 4.2.1 used by OpenBSD or GCC 4.4.7 shipped with RHEL6 going by a commit to fix a similiar problem in radeonsi earlier in the year (74388dd24bc7fdb9e62ec18096163f5426e03fbf). Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jonathan Gray <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_packed_float.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_packed_float.c b/src/mesa/drivers/dri/i965/brw_packed_float.c
index 329ba15a8d2..9b7687a756f 100644
--- a/src/mesa/drivers/dri/i965/brw_packed_float.c
+++ b/src/mesa/drivers/dri/i965/brw_packed_float.c
@@ -29,7 +29,7 @@ union fu {
unsigned mantissa:23;
unsigned exponent:8;
unsigned sign:1;
- };
+ } s;
};
int
@@ -39,11 +39,11 @@ brw_float_to_vf(float f)
/* ±0.0f is special cased. */
if (f == 0.0f)
- return fu.sign << 7;
+ return fu.s.sign << 7;
- unsigned mantissa = fu.mantissa >> (23 - 4);
- unsigned exponent = fu.exponent - (127 - 3);
- unsigned vf = (fu.sign << 7) | (exponent << 4) | mantissa;
+ unsigned mantissa = fu.s.mantissa >> (23 - 4);
+ unsigned exponent = fu.s.exponent - (127 - 3);
+ unsigned vf = (fu.s.sign << 7) | (exponent << 4) | mantissa;
/* 0.125 would have had the same representation as 0.0, so reject it. */
if ((vf & 0x7f) == 0)
@@ -67,9 +67,9 @@ brw_vf_to_float(unsigned char vf)
return fu.f;
}
- fu.sign = vf >> 7;
- fu.exponent = ((vf & 0x70) >> 4) + (127 - 3);
- fu.mantissa = (vf & 0xf) << (23 - 4);
+ fu.s.sign = vf >> 7;
+ fu.s.exponent = ((vf & 0x70) >> 4) + (127 - 3);
+ fu.s.mantissa = (vf & 0xf) << (23 - 4);
return fu.f;
}