You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
A pack of fixes for compilation errors and warnings for all platforms
Add libdatatypes.so into debian packaging
This commit is contained in:
@ -18,25 +18,33 @@
|
||||
#define UTILS_COMMON_CHECKS_H
|
||||
|
||||
#include <type_traits>
|
||||
#include "mcs_int128.h"
|
||||
|
||||
namespace utils {
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_unsigned<T>::value, bool>::type is_nonnegative(T)
|
||||
{ return true; };
|
||||
typename std::enable_if<std::is_unsigned<T>::value ||
|
||||
datatypes::is_uint128_t<T>::value,
|
||||
bool>::type
|
||||
is_nonnegative(T) { return true; };
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_signed<T>::value, bool>::type is_nonnegative(T v)
|
||||
{ return v >= 0; };
|
||||
|
||||
typename std::enable_if<std::is_signed<T>::value ||
|
||||
datatypes::is_int128_t<T>::value,
|
||||
bool>::type
|
||||
is_nonnegative(T v) { return v >= 0; };
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_unsigned<T>::value, bool>::type is_negative(T)
|
||||
{ return false; };
|
||||
typename std::enable_if<std::is_unsigned<T>::value ||
|
||||
datatypes::is_uint128_t<T>::value,
|
||||
bool>::type
|
||||
is_negative(T) { return false; };
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_signed<T>::value, bool>::type is_negative(T v)
|
||||
{ return v < 0; };
|
||||
typename std::enable_if<std::is_signed<T>::value ||
|
||||
datatypes::is_int128_t<T>::value,
|
||||
bool>::type
|
||||
is_negative(T v) { return v < 0; };
|
||||
|
||||
} // namespace utils
|
||||
|
||||
|
@ -383,7 +383,7 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row,
|
||||
uint128_t tmpval = d.s128Value / scaleDivisor;
|
||||
int128_t lefto = (d.s128Value - tmpval * scaleDivisor) / scaleDivisor2;
|
||||
|
||||
if (tmpval >= 0 && lefto > 4)
|
||||
if (utils::is_nonnegative(tmpval) && lefto > 4)
|
||||
tmpval++;
|
||||
|
||||
if (tmpval > static_cast<int128_t>(UINT64_MAX))
|
||||
@ -404,7 +404,9 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row,
|
||||
int lefto = (d.value - value * pow(10.0, dscale)) / pow(10.0, dscale - 1);
|
||||
|
||||
if ( utils::is_nonnegative(value) && lefto > 4 )
|
||||
{
|
||||
value++;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -86,10 +86,10 @@ string Func_elt::getStrVal(rowgroup::Row& row,
|
||||
int128_t tmpval = d.s128Value / scaleDivisor;
|
||||
int128_t lefto = (d.s128Value - tmpval * scaleDivisor) / scaleDivisor2;
|
||||
|
||||
if (utils::is_nonnegative(tmpval) >= 0 && lefto > 4)
|
||||
if (utils::is_nonnegative(tmpval) && lefto > 4)
|
||||
tmpval++;
|
||||
|
||||
if (utils::is_negative(tmpval) < 0 && lefto < -4)
|
||||
if (utils::is_negative(tmpval) && lefto < -4)
|
||||
tmpval--;
|
||||
|
||||
number = datatypes::Decimal::getInt64FromWideDecimal(tmpval);
|
||||
|
Reference in New Issue
Block a user