Commit 4bd3e4e0 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

fix MSVC C5219 in to_ascii

Summary:
Fixes the following warning:

```
folly/lang/ToAscii.h(224): warning C5219: implicit conversion from 'T' to 'double', possible loss of data
        with
        [
            T=size_t
        ]
folly/lang/ToAscii.h(236): note: see reference to function template instantiation 'size_t folly::detail::to_ascii_size_clzll<10>(uint64_t)' being compiled
folly/lang/ToAscii.h(349): note: see reference to function template instantiation 'size_t folly::detail::to_ascii_size_route<10>(uint64_t)' being compiled
folly/lang/ToAscii.h(358): note: see reference to function template instantiation 'size_t folly::to_ascii_size<10>(uint64_t)' being compiled
```

Reviewed By: luciang

Differential Revision: D31314625

fbshipit-source-id: b32a566b67d2f04225b59ee682931d5f8d9ede1e
parent 4dbcd7ba
...@@ -221,7 +221,8 @@ FOLLY_ALWAYS_INLINE size_t to_ascii_size_clzll(uint64_t v) { ...@@ -221,7 +221,8 @@ FOLLY_ALWAYS_INLINE size_t to_ascii_size_clzll(uint64_t v) {
} }
// blog2r is approx 1 / log<2>(Base), used in log change-of-base just below // blog2r is approx 1 / log<2>(Base), used in log change-of-base just below
constexpr auto const blog2r = 8. / constexpr_log2(constexpr_pow(Base, 8)); constexpr auto const blog2m = constexpr_log2(constexpr_pow(Base, 8));
constexpr auto const blog2r = 8. / double(blog2m);
// vlogb is approx log<Base>(v) = log<2>(v) / log<2>(Base) // vlogb is approx log<Base>(v) = log<2>(v) / log<2>(Base)
auto const vlogb = vlog2 * size_t(blog2r * 256) / 256; auto const vlogb = vlog2 * size_t(blog2r * 256) / 256;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment