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,14 +393,14 @@ private:
|
|||||||
m_limbs = new_size;
|
m_limbs = new_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_MP_FORCEINLINE constexpr void normalize() noexcept
|
BOOST_MP_FORCEINLINE void normalize() noexcept
|
||||||
{
|
{
|
||||||
limb_pointer p = limbs();
|
limb_pointer p = limbs();
|
||||||
while ((m_limbs - 1) && !p[m_limbs - 1])
|
while ((m_limbs - 1) && !p[m_limbs - 1])
|
||||||
--m_limbs;
|
--m_limbs;
|
||||||
}
|
}
|
||||||
BOOST_MP_FORCEINLINE constexpr cpp_int_base() noexcept : m_data(), m_limbs(1), m_sign(false), m_internal(true), m_alias(false){}
|
BOOST_MP_FORCEINLINE constexpr cpp_int_base() noexcept : m_data(), m_limbs(1), m_sign(false), m_internal(true), m_alias(false){}
|
||||||
BOOST_MP_FORCEINLINE cpp_int_base(const cpp_int_base& o) : base_type(o), m_limbs(o.m_alias ? o.m_limbs : 0), m_sign(o.m_sign), m_internal(o.m_alias ? false : true), m_alias(o.m_alias)
|
BOOST_MP_FORCEINLINE cpp_int_base(const cpp_int_base& o) : base_type(o), m_limbs(o.m_alias ? o.m_limbs : 0), m_sign(o.m_sign), m_internal(o.m_alias ? false : true), m_alias(o.m_alias)
|
||||||
{
|
{
|
||||||
if (m_alias)
|
if (m_alias)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Copyright 2013 John Maddock.
|
// Copyright 2013 John Maddock. Distributed under the Boost
|
||||||
// Copyright 2026 Christopher Kormanyos
|
|
||||||
// Distributed under the Boost
|
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
// 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)() \
|
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 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>; \
|
return boost::multiprecision::literals::detail::make_backend_from_pack< \
|
||||||
auto result { boost::multiprecision::literals::detail::make_backend_from_pack<pt, local_backend_type >::value }; \
|
pt, \
|
||||||
result.normalize(); \
|
boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >::value; \
|
||||||
return result; \
|
|
||||||
} \
|
} \
|
||||||
template <char... STR> \
|
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)() \
|
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 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>; \
|
return boost::multiprecision::literals::detail::make_backend_from_pack< \
|
||||||
auto result { boost::multiprecision::literals::detail::make_backend_from_pack<pt, local_backend_type >::value }; \
|
pt, \
|
||||||
result.normalize(); \
|
boost::multiprecision::backends::cpp_int_backend<Bits, Bits, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >::value; \
|
||||||
return result; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(128)
|
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(128)
|
||||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(256)
|
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(512)
|
||||||
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(1024)
|
BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(1024)
|
||||||
#undef BOOST_MP_LIT
|
#undef BOOST_MP_LIT
|
||||||
|
|||||||
@@ -1283,7 +1283,6 @@ test-suite misc :
|
|||||||
[ run git_issue_734.cpp ]
|
[ run git_issue_734.cpp ]
|
||||||
[ run git_issue_743.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
|
[ 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_759.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
|
||||||
[ run git_issue_766.cpp ]
|
|
||||||
[ compile git_issue_98.cpp :
|
[ compile git_issue_98.cpp :
|
||||||
[ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ]
|
[ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ]
|
||||||
[ check-target-builds ../config//has_gmp : <define>TEST_GMP <source>gmp : ]
|
[ 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