mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-07-21 13:23:49 +00:00
Revert mistakenly pushed to develop
This commit is contained in:
@@ -393,7 +393,7 @@ private:
|
||||
m_limbs = new_size;
|
||||
}
|
||||
}
|
||||
BOOST_MP_FORCEINLINE constexpr void normalize() noexcept
|
||||
BOOST_MP_FORCEINLINE void normalize() noexcept
|
||||
{
|
||||
limb_pointer p = limbs();
|
||||
while ((m_limbs - 1) && !p[m_limbs - 1])
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2013 John Maddock.
|
||||
// Copyright 2026 Christopher Kormanyos
|
||||
// Distributed under the Boost
|
||||
// Copyright 2013 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
@@ -257,24 +255,21 @@ constexpr typename boost::multiprecision::literals::detail::unsigned_cpp_int_lit
|
||||
constexpr boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > BOOST_MP_LIT(_cppi, Bits)() \
|
||||
{ \
|
||||
using pt = typename boost::multiprecision::literals::detail::make_packed_value_from_str<STR...>::type; \
|
||||
using local_backend_type = boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>; \
|
||||
auto result { boost::multiprecision::literals::detail::make_backend_from_pack<pt, local_backend_type >::value }; \
|
||||
result.normalize(); \
|
||||
return result; \
|
||||
return boost::multiprecision::literals::detail::make_backend_from_pack< \
|
||||
pt, \
|
||||
boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >::value; \
|
||||
} \
|
||||
template <char... STR> \
|
||||
constexpr boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> > BOOST_MP_LIT(_cppui, Bits)() \
|
||||
{ \
|
||||
using pt = typename boost::multiprecision::literals::detail::make_packed_value_from_str<STR...>::type; \
|
||||
using local_backend_type = boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>; \
|
||||
auto result { boost::multiprecision::literals::detail::make_backend_from_pack<pt, local_backend_type >::value }; \
|
||||
result.normalize(); \
|
||||
return result; \
|
||||
return boost::multiprecision::literals::detail::make_backend_from_pack< \
|
||||
pt, \
|
||||
boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >::value; \
|
||||
}
|
||||
|
||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(128)
|
||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(256)
|
||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(384)
|
||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(512)
|
||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(1024)
|
||||
#undef BOOST_MP_LIT
|
||||
|
||||
@@ -1283,7 +1283,6 @@ test-suite misc :
|
||||
[ run git_issue_734.cpp ]
|
||||
[ run git_issue_743.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
|
||||
[ run git_issue_759.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
|
||||
[ run git_issue_766.cpp ]
|
||||
[ compile git_issue_98.cpp :
|
||||
[ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ]
|
||||
[ check-target-builds ../config//has_gmp : <define>TEST_GMP <source>gmp : ]
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
namespace Mp = boost::multiprecision;
|
||||
using namespace boost::multiprecision::literals;
|
||||
|
||||
using uint384_t = Mp::number<Mp::cpp_int_backend<384, 384, Mp::unsigned_magnitude, Mp::unchecked, void>, Mp::et_off>;
|
||||
using int512_t = Mp::number<Mp::cpp_int_backend<512, 512, Mp::signed_magnitude, Mp::unchecked, void>, Mp::et_off>;
|
||||
|
||||
template <char... TStr>
|
||||
constexpr auto operator""_u384() -> uint384_t
|
||||
{
|
||||
return operator""_cppui384 < TStr...>();
|
||||
}
|
||||
|
||||
template <char... TStr>
|
||||
constexpr auto operator""_i512() -> int512_t
|
||||
{
|
||||
return operator""_cppi512 < TStr...>();
|
||||
}
|
||||
|
||||
auto main() -> int
|
||||
{
|
||||
{
|
||||
constexpr auto value { 0x00000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111_u384 };
|
||||
constexpr auto mask { 0x0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF_u384 };
|
||||
|
||||
constexpr auto masked { value & mask };
|
||||
|
||||
constexpr bool result_mask_is_ok { (value == masked) };
|
||||
constexpr bool result_size_is_ok { (value.backend().size() == masked.backend().size()) };
|
||||
|
||||
static_assert(result_mask_is_ok, "Error: unexpected value results in non-equality");
|
||||
static_assert(result_size_is_ok, "Error: unexpected size results in non-equality");
|
||||
|
||||
BOOST_TEST(result_mask_is_ok);
|
||||
BOOST_TEST(result_size_is_ok);
|
||||
}
|
||||
|
||||
{
|
||||
constexpr auto value { 0x00000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111_i512 };
|
||||
constexpr auto mask { 0x0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF_i512 };
|
||||
|
||||
constexpr auto masked { value & mask };
|
||||
|
||||
constexpr bool result_mask_is_ok { (value == masked) };
|
||||
constexpr bool result_size_is_ok { (value.backend().size() == masked.backend().size()) };
|
||||
|
||||
static_assert(result_mask_is_ok, "Error: unexpected value results in non-equality");
|
||||
static_assert(result_size_is_ok, "Error: unexpected size results in non-equality");
|
||||
|
||||
BOOST_TEST(result_mask_is_ok);
|
||||
BOOST_TEST(result_size_is_ok);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user