mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Merge pull request #42968 from ClickHouse/bitcast
Less use of CH-specific bit_cast()
This commit is contained in:
commit
2c568df714
@ -1,7 +1,6 @@
|
||||
#include "ExternalDictionaryLibraryHandler.h"
|
||||
|
||||
#include <base/scope_guard.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <base/find_symbols.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
|
||||
@ -113,7 +112,7 @@ Block ExternalDictionaryLibraryHandler::loadAll()
|
||||
|
||||
Block ExternalDictionaryLibraryHandler::loadIds(const std::vector<uint64_t> & ids)
|
||||
{
|
||||
const ExternalDictionaryLibraryAPI::VectorUInt64 ids_data{bit_cast<decltype(ExternalDictionaryLibraryAPI::VectorUInt64::data)>(ids.data()), ids.size()};
|
||||
const ExternalDictionaryLibraryAPI::VectorUInt64 ids_data{std::bit_cast<decltype(ExternalDictionaryLibraryAPI::VectorUInt64::data)>(ids.data()), ids.size()};
|
||||
|
||||
auto columns_holder = std::make_unique<ExternalDictionaryLibraryAPI::CString[]>(attributes_names.size());
|
||||
ExternalDictionaryLibraryAPI::CStrings columns_pass{static_cast<decltype(ExternalDictionaryLibraryAPI::CStrings::data)>(columns_holder.get()), attributes_names.size()};
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
#include <Core/Block.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <base/range.h>
|
||||
|
||||
#include "ExternalDictionaryLibraryAPI.h"
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <Core/Block.h>
|
||||
#include <base/StringRef.h>
|
||||
#include <Common/DateLUT.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <IO/ReadBufferFromFileDescriptor.h>
|
||||
#include <IO/WriteBufferFromFileDescriptor.h>
|
||||
#include <IO/ReadBufferFromFile.h>
|
||||
@ -278,9 +277,9 @@ Float transformFloatMantissa(Float x, UInt64 seed)
|
||||
using UInt = std::conditional_t<std::is_same_v<Float, Float32>, UInt32, UInt64>;
|
||||
constexpr size_t mantissa_num_bits = std::is_same_v<Float, Float32> ? 23 : 52;
|
||||
|
||||
UInt x_uint = bit_cast<UInt>(x);
|
||||
UInt x_uint = std::bit_cast<UInt>(x);
|
||||
x_uint = static_cast<UInt>(feistelNetwork(x_uint, mantissa_num_bits, seed));
|
||||
return bit_cast<Float>(x_uint);
|
||||
return std::bit_cast<Float>(x_uint);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <base/types.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <base/sort.h>
|
||||
#include <Common/HashTable/HashMap.h>
|
||||
|
||||
@ -104,13 +103,13 @@ private:
|
||||
/// Take the most significant 16 bits of the floating point number.
|
||||
BFloat16 toBFloat16(const Value & x) const
|
||||
{
|
||||
return bit_cast<UInt32>(static_cast<Float32>(x)) >> 16;
|
||||
return std::bit_cast<UInt32>(static_cast<Float32>(x)) >> 16;
|
||||
}
|
||||
|
||||
/// Put the bits into most significant 16 bits of the floating point number and fill other bits with zeros.
|
||||
Float32 toFloat32(const BFloat16 & x) const
|
||||
{
|
||||
return bit_cast<Float32>(x << 16);
|
||||
return std::bit_cast<Float32>(x << 16);
|
||||
}
|
||||
|
||||
using Pair = PairNoInit<Float32, Weight>;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <Common/quoteString.h>
|
||||
#include <Common/setThreadName.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <Parsers/CommonParsers.h>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <cmath>
|
||||
#include <type_traits>
|
||||
#include <array>
|
||||
#include <base/bit_cast.h>
|
||||
#include <base/sort.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <Functions/FunctionNumericPredicate.h>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
@ -20,11 +19,11 @@ struct IsFiniteImpl
|
||||
static bool execute(const T t)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, float>)
|
||||
return (bit_cast<uint32_t>(t)
|
||||
return (std::bit_cast<uint32_t>(t)
|
||||
& 0b01111111100000000000000000000000)
|
||||
!= 0b01111111100000000000000000000000;
|
||||
else if constexpr (std::is_same_v<T, double>)
|
||||
return (bit_cast<uint64_t>(t)
|
||||
return (std::bit_cast<uint64_t>(t)
|
||||
& 0b0111111111110000000000000000000000000000000000000000000000000000)
|
||||
!= 0b0111111111110000000000000000000000000000000000000000000000000000;
|
||||
else
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <Functions/FunctionNumericPredicate.h>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
@ -16,11 +15,11 @@ struct IsInfiniteImpl
|
||||
static bool execute(const T t)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, float>)
|
||||
return (bit_cast<uint32_t>(t)
|
||||
return (std::bit_cast<uint32_t>(t)
|
||||
& 0b01111111111111111111111111111111)
|
||||
== 0b01111111100000000000000000000000;
|
||||
else if constexpr (std::is_same_v<T, double>)
|
||||
return (bit_cast<uint64_t>(t)
|
||||
return (std::bit_cast<uint64_t>(t)
|
||||
& 0b0111111111111111111111111111111111111111111111111111111111111111)
|
||||
== 0b0111111111110000000000000000000000000000000000000000000000000000;
|
||||
else
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <Functions/GatherUtils/Algorithms.h>
|
||||
#include <Functions/GatherUtils/Sinks.h>
|
||||
#include <Functions/GatherUtils/Sources.h>
|
||||
#include <base/bit_cast.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -59,10 +58,10 @@ namespace
|
||||
{
|
||||
if (num_chars <= step)
|
||||
{
|
||||
writeSlice(StringSource::Slice{bit_cast<const UInt8 *>(pad_string.data()), numCharsToNumBytes(num_chars)}, res_sink);
|
||||
writeSlice(StringSource::Slice{std::bit_cast<const UInt8 *>(pad_string.data()), numCharsToNumBytes(num_chars)}, res_sink);
|
||||
break;
|
||||
}
|
||||
writeSlice(StringSource::Slice{bit_cast<const UInt8 *>(pad_string.data()), numCharsToNumBytes(step)}, res_sink);
|
||||
writeSlice(StringSource::Slice{std::bit_cast<const UInt8 *>(pad_string.data()), numCharsToNumBytes(step)}, res_sink);
|
||||
num_chars -= step;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <base/bit_cast.h>
|
||||
#include <Common/HashTable/Hash.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/ColumnArray.h>
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <Storages/MergeTree/MergeTreeIndexAggregatorBloomFilter.h>
|
||||
|
||||
#include <base/bit_cast.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnFixedString.h>
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <Interpreters/TreeRewriter.h>
|
||||
#include <Interpreters/ExpressionAnalyzer.h>
|
||||
#include <base/types.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <Storages/MergeTree/MergeTreeIndexConditionBloomFilter.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <Columns/ColumnFixedString.h>
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <Common/HashTable/Hash.h>
|
||||
#include <base/bit_cast.h>
|
||||
#include <Interpreters/BloomFilterHash.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user