diff options
author | zverevgeny <zverevgeny@ydb.tech> | 2023-09-01 19:46:14 +0300 |
---|---|---|
committer | zverevgeny <zverevgeny@ydb.tech> | 2023-09-01 20:00:28 +0300 |
commit | 3e1bd942be74d55745b29634b9555abd8c1441e6 (patch) | |
tree | fcec66046099993bacfd614435538a3daeb56aed | |
parent | 8ac98a9125aef1c4b0c10d01a7995b4af7c84cb6 (diff) | |
download | ydb-3e1bd942be74d55745b29634b9555abd8c1441e6.tar.gz |
fix build on win, integer overflow for i64
-rw-r--r-- | ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp index 975443fe3f..cb99784015 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp @@ -10,11 +10,13 @@ namespace { template<typename T> ui64 ShiftByMaxNegative(T value) { - if (std::is_signed<T>()) { + static_assert(sizeof(T) <= sizeof(ui64)); + //static_assert(std::is_integral_v<T>); //TODO fixme, very stange behaviour for floating point types + if constexpr (std::is_signed_v<T>) { if (value < 0) { return ui64(value + std::numeric_limits<T>::max() + T(1)); } - return ui64(value) + ui64(std::numeric_limits<T>::max() + 1ul); + return ui64(value) + ui64(std::numeric_limits<T>::max()) + 1ul; } return ui64(value); } |