Skip to content

Commit

Permalink
Update dbms/src/IO/Compression/EncodingUtil.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: jinhelin <linjinhe33@gmail.com>
  • Loading branch information
Lloyd-Pottiger and JinheLin committed Jun 7, 2024
1 parent 91aae71 commit 160114f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions dbms/src/IO/Compression/EncodingUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ UInt8 FOREncodingWidth(std::vector<T> & values, T frame_of_reference)
// The minimum bit width required to store the values is 8 rather than the width of `max_value - min_value = -1`.
// So we need to calculate the minimum bit width of the values after subtracting frame of reference.
subtractFrameOfReference<T>(values.data(), frame_of_reference, values.size());
T max_value = *std::max_element(values.cbegin(), values.cend());
T min_value = *std::min_element(values.cbegin(), values.cend());
return BitpackingPrimitives::minimumBitWidth<T>(min_value, max_value);
auto [min_value, max_value] = std::minmax_element(values.cbegin(), values.cend());
return BitpackingPrimitives::minimumBitWidth<T>(*min_value, *max_value);
}
else
{
Expand Down

0 comments on commit 160114f

Please sign in to comment.