externals: Update mcl to 0.1.7
Merge commit '5da4668a0d928ffa527ca03642902c92c4b78a64'
This commit is contained in:
commit
da45f689b9
2 changed files with 7 additions and 11 deletions
2
externals/mcl/CMakeLists.txt
vendored
2
externals/mcl/CMakeLists.txt
vendored
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
project(mcl LANGUAGES CXX VERSION 0.1.6)
|
project(mcl LANGUAGES CXX VERSION 0.1.7)
|
||||||
|
|
||||||
# Project options
|
# Project options
|
||||||
option(MCL_WARNINGS_AS_ERRORS "Warnings as errors" ON)
|
option(MCL_WARNINGS_AS_ERRORS "Warnings as errors" ON)
|
||||||
|
|
16
externals/mcl/include/mcl/bit/bit_field.hpp
vendored
16
externals/mcl/include/mcl/bit/bit_field.hpp
vendored
|
@ -143,11 +143,9 @@ template<size_t bit_count, BitIntegral T>
|
||||||
constexpr T sign_extend(T value) {
|
constexpr T sign_extend(T value) {
|
||||||
static_assert(bit_count != 0, "cannot sign-extend zero-sized value");
|
static_assert(bit_count != 0, "cannot sign-extend zero-sized value");
|
||||||
|
|
||||||
constexpr T m = ones<bit_count, T>();
|
using S = std::make_signed_t<T>;
|
||||||
if (get_bit<bit_count - 1, T>(value)) {
|
constexpr size_t shift_amount = bitsizeof<T> - bit_count;
|
||||||
return value | ~m;
|
return static_cast<T>(static_cast<S>(value << shift_amount) >> shift_amount);
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sign-extends a value that has bit_count bits to the full bitwidth of type T.
|
/// Sign-extends a value that has bit_count bits to the full bitwidth of type T.
|
||||||
|
@ -155,11 +153,9 @@ template<BitIntegral T>
|
||||||
constexpr T sign_extend(size_t bit_count, T value) {
|
constexpr T sign_extend(size_t bit_count, T value) {
|
||||||
ASSERT_MSG(bit_count != 0, "cannot sign-extend zero-sized value");
|
ASSERT_MSG(bit_count != 0, "cannot sign-extend zero-sized value");
|
||||||
|
|
||||||
const T m = ones<T>(bit_count);
|
using S = std::make_signed_t<T>;
|
||||||
if (get_bit<T>(bit_count - 1, value)) {
|
const size_t shift_amount = bitsizeof<T> - bit_count;
|
||||||
return value | ~m;
|
return static_cast<T>(static_cast<S>(value << shift_amount) >> shift_amount);
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replicate an element across a value of type T.
|
/// Replicate an element across a value of type T.
|
||||||
|
|
Loading…
Reference in a new issue