summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2022-04-18 13:34:22 +0800
committerGitHub <noreply@github.com>2022-04-18 08:34:22 +0300
commitfe4b4806b3f39256a82020a1cd2e832ebabc2ef9 (patch)
tree49a086a7a824a3176fb116da5bef072b8fb487fa /src/util.c
parent0c4733c8d7c50e0b0dc3373733fddfff3f62dda0 (diff)
downloadredis-fe4b4806b3f39256a82020a1cd2e832ebabc2ef9.tar.gz
Fix long long to double implicit conversion warning (#10595)
There is a implicit conversion warning in clang: ``` util.c:574:23: error: implicit conversion from 'long long' to 'double' changes value from -4611686018427387903 to -4611686018427387904 [-Werror,-Wimplicit-const-int-float-conversion] if (d < -LLONG_MAX/2 || d > LLONG_MAX/2) ``` introduced in #10486 Co-authored-by: sundb <sundbcn@gmail.com>
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index ae1f89b65..85b631f19 100644
--- a/src/util.c
+++ b/src/util.c
@@ -571,7 +571,7 @@ int double2ll(double d, long long *out) {
* i.e. all double values in that range are representable as a long without precision loss,
* but not all long values in that range can be represented as a double.
* we only care about the first part here. */
- if (d < -LLONG_MAX/2 || d > LLONG_MAX/2)
+ if (d < (double)(-LLONG_MAX/2) || d > (double)(LLONG_MAX/2))
return 0;
long long ll = d;
if (ll == d) {