summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_constant_expression.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 2853c1643b3..309b6b72b5b 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -230,12 +230,9 @@ pack_snorm_1x8(float x)
* follows:
*
* packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
- *
- * We must first cast the float to an int, because casting a negative
- * float to a uint is undefined.
*/
- return (uint8_t) (int)
- _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
+ return (uint8_t)
+ _mesa_lroundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
}
/**
@@ -252,12 +249,9 @@ pack_snorm_1x16(float x)
* follows:
*
* packSnorm2x16: round(clamp(c, -1, +1) * 32767.0)
- *
- * We must first cast the float to an int, because casting a negative
- * float to a uint is undefined.
*/
- return (uint16_t) (int)
- _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
+ return (uint16_t)
+ _mesa_lroundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
}
/**