Highlight potential bugs in code

This commit is contained in:
Alexey Milovidov 2021-04-05 01:38:47 +03:00
parent 6c5aab28e8
commit 6e93d936d3

View File

@ -274,12 +274,14 @@ inline bool greaterOp<DB::UInt64, DB::Float32>(DB::UInt64 u, DB::Float32 f)
template <> template <>
inline bool greaterOp<DB::Float64, DB::UInt128>(DB::Float64 f, DB::UInt128 u) inline bool greaterOp<DB::Float64, DB::UInt128>(DB::Float64 f, DB::UInt128 u)
{ {
/// TODO: This is wrong.
return u.low == 0 && greaterOp(f, u.high); return u.low == 0 && greaterOp(f, u.high);
} }
template <> template <>
inline bool greaterOp<DB::UInt128, DB::Float64>(DB::UInt128 u, DB::Float64 f) inline bool greaterOp<DB::UInt128, DB::Float64>(DB::UInt128 u, DB::Float64 f)
{ {
/// TODO: This is wrong.
return u.low != 0 || greaterOp(u.high, f); return u.low != 0 || greaterOp(u.high, f);
} }
@ -360,6 +362,7 @@ inline bool NO_SANITIZE_UNDEFINED equalsOp<DB::Int64, DB::Float32>(DB::Int64 u,
template <> template <>
inline bool NO_SANITIZE_UNDEFINED equalsOp<DB::UInt128, DB::Float64>(DB::UInt128 u, DB::Float64 f) inline bool NO_SANITIZE_UNDEFINED equalsOp<DB::UInt128, DB::Float64>(DB::UInt128 u, DB::Float64 f)
{ {
/// TODO: This is wrong.
return u.low == 0 && equalsOp(static_cast<UInt64>(u.high), f); return u.low == 0 && equalsOp(static_cast<UInt64>(u.high), f);
} }