Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Statically checking for overflow with if constexpr (sizeof(std::size_t) <= sizeof(std::int64_t)) { return static_cast<std::int64_t>(length); } Doesn't work if `sizeof(std::size_t) == sizeof(std::int64_t)` because std::size_t is unsigned. if `length == std::numeric_limits<size_t>` casting it to `int64_t` is going to overflow. This code would be much simpler if returning a `uint64_t` instead of a signed value... Differential Revision: https://reviews.llvm.org/D122705
- Loading branch information