Files
scylladb/test/boost
Kefu Chai 1197664f09 test: network_topology_strategy_test: silence warning
clang warns when the implicit conversion changes the precision of the
converted number. in this case, the before being multiplied,
`std::numeric_limits<unsigned long>::max() >> 1` is implicitly
promoted to double so it can obtain the common type of double and
unsigned long. and the compiler warns:

```
/home/kefu/dev/scylladb/test/boost/network_topology_strategy_test.cc:129:84: error: implicit conversion from 'unsigned long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
    return static_cast<unsigned long>(d*(std::numeric_limits<unsigned long>::max() >> 1)) << 1;
                                       ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
```
but

1. we don't really care about the precision here, we just want to map a
   double to a token represented by an int64_t
2. the maximum possible number being converted is less than
   9223372036854775807, which is the maximum number of int64_t, which
   is in general an alias of `long long`, not to mention that
   LONG_MAX is always 2147483647, after shifting right, the result
   would be 1073741823

so this is a false alarm. in order to silence it, we explicitly
cast the RHS of `*` operator to double.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #13221
2023-03-23 08:55:29 +02:00
..
2023-02-15 11:01:50 +02:00
2023-03-17 12:56:09 +08:00
2023-02-15 11:01:50 +02:00
2023-02-15 11:01:50 +02:00
2022-11-16 16:30:38 +02:00
2023-02-15 11:09:04 +02:00
2023-02-15 11:01:50 +02:00
2023-02-15 11:01:50 +02:00