glsl: correct bitcast-helpers
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 24 Sep 2019 14:57:03 +0000 (16:57 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 25 Sep 2019 04:52:54 +0000 (04:52 +0000)
Without this, we'll incorrectly round off huge values to the nearest
representable double instead of keeping it at the exact value  as
we're supposed to.

Found by inspecting compiler-warnings.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 85faf5082f ("glsl: Add 64-bit integer support for constant expressions")
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/compiler/glsl/ir_constant_expression.cpp

index e5893103ed2336d661d6d205cf8031cb7b78e591..1605e571758864942405bb4c022ee36e3376ae36 100644 (file)
@@ -106,7 +106,7 @@ bitcast_i642d(int64_t i)
    return d;
 }
 
-static double
+static uint64_t
 bitcast_d2u64(double d)
 {
    assert(sizeof(double) == sizeof(uint64_t));
@@ -115,7 +115,7 @@ bitcast_d2u64(double d)
    return u;
 }
 
-static double
+static int64_t
 bitcast_d2i64(double d)
 {
    assert(sizeof(double) == sizeof(int64_t));