Skip to content

Commit be7676b

Browse files
authored
Merge pull request #897 from cppalliance/integration
Change 128-bit backend to cppalliance/int128
2 parents db37368 + ae909fb commit be7676b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+10510
-3739
lines changed

.drone.jsonnet

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -254,34 +254,6 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
254254
"g++-14-multilib",
255255
),
256256

257-
linux_pipeline(
258-
"Linux 18.04 GCC 7* 32 03",
259-
"cppalliance/droneubuntu1804:1",
260-
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03', ADDRMD: '32' },
261-
"nload",
262-
),
263-
264-
linux_pipeline(
265-
"Linux 18.04 GCC 7* 32 11",
266-
"cppalliance/droneubuntu1804:1",
267-
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '11', ADDRMD: '32' },
268-
"nload",
269-
),
270-
271-
linux_pipeline(
272-
"Linux 18.04 GCC 7* 32 14",
273-
"cppalliance/droneubuntu1804:1",
274-
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '14', ADDRMD: '32' },
275-
"nload",
276-
),
277-
278-
linux_pipeline(
279-
"Linux 18.04 GCC 7* 32 17",
280-
"cppalliance/droneubuntu1804:1",
281-
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '17', ADDRMD: '32' },
282-
"nload",
283-
),
284-
285257
linux_pipeline(
286258
"Linux 18.04 GCC 7* 64 03",
287259
"cppalliance/droneubuntu1804:1",

.github/workflows/ci.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
include:
3737
- toolset: gcc-7
3838
cxxstd: "03,11,14,17"
39-
address_model: 32,64
39+
address_model: 64
4040
os: ubuntu-latest
4141
container: ubuntu:18.04
4242
install:
@@ -105,24 +105,29 @@ jobs:
105105
container: ubuntu:22.04
106106
install:
107107
- g++-12-multilib
108-
- name: 32-bit UBSAN
109-
toolset: gcc-12
110-
cxxstd: "03,11,14,17,20,23"
108+
- toolset: gcc-14
109+
cxxstd: "03,11,14,17,20,23,2c"
110+
address_model: "64"
111+
os: ubuntu-latest
112+
container: ubuntu:24.04
113+
install:
114+
- g++-14-multilib
115+
- toolset: gcc-14
116+
cxxstd: "03,11,14,17,20,23,2c"
111117
address_model: "32"
112-
ubsan: 1
113118
os: ubuntu-latest
114-
container: ubuntu:22.04
119+
container: ubuntu:24.04
115120
install:
116-
- g++-12-multilib
121+
- g++-14-multilib
117122
- name: 64-bit UBSAN
118-
toolset: gcc-12
119-
cxxstd: "03,11,14,17,20,23"
123+
toolset: gcc-14
124+
cxxstd: "03,11,14,17,20,23,2c"
120125
address_model: "64"
121126
ubsan: 1
122127
os: ubuntu-latest
123-
container: ubuntu:22.04
128+
container: ubuntu:24.04
124129
install:
125-
- g++-12-multilib
130+
- g++-14-multilib
126131

127132
# Linux, clang
128133
- toolset: clang
@@ -491,10 +496,11 @@ jobs:
491496
fail-fast: false
492497
matrix:
493498
include:
494-
- toolset: msvc-14.3
495-
cxxstd: "14,17,20,latest"
496-
addrmd: "32"
497-
os: windows-2022
499+
# Release mode has gobs of math failures that are not present in debug mode
500+
#- toolset: msvc-14.3
501+
# cxxstd: "14,17,20,latest"
502+
# addrmd: "32"
503+
# os: windows-2022
498504
- toolset: msvc-14.3
499505
cxxstd: "14,17,20,latest"
500506
addrmd: "64"

include/boost/decimal/bid_conversion.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <boost/decimal/decimal32_fast.hpp>
1212
#include <boost/decimal/decimal64_fast.hpp>
1313
#include <boost/decimal/decimal128_fast.hpp>
14-
#include <boost/decimal/uint128.hpp>
1514
#include <boost/decimal/detail/concepts.hpp>
15+
#include <boost/int128.hpp>
1616

1717
namespace boost {
1818
namespace decimal {
@@ -68,38 +68,38 @@ BOOST_DECIMAL_EXPORT constexpr auto from_bid_d64f(std::uint64_t bits) noexcept -
6868
return val;
6969
}
7070

71-
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d128(decimal128 val) noexcept -> uint128
71+
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d128(decimal128 val) noexcept -> int128::uint128_t
7272
{
7373
return val.bits_;
7474
}
7575

76-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128(uint128 bits) noexcept -> decimal128
76+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128(int128::uint128_t bits) noexcept -> decimal128
7777
{
7878
return from_bits(bits);
7979
}
8080

8181
#ifdef BOOST_DECIMAL_HAS_INT128
82-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128(detail::uint128_t bits) noexcept -> decimal128
82+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128(detail::builtin_uint128_t bits) noexcept -> decimal128
8383
{
8484
return from_bits(bits);
8585
}
8686
#endif
8787

88-
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d128f(decimal128_fast val) noexcept -> uint128
88+
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d128f(decimal128_fast val) noexcept -> int128::uint128_t
8989
{
9090
const decimal128 compliant_val {val};
9191
return to_bid_d128(compliant_val);
9292
}
9393

94-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128f(uint128 bits) noexcept -> decimal128_fast
94+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128f(int128::uint128_t bits) noexcept -> decimal128_fast
9595
{
9696
const auto compliant_val {from_bid_d128(bits)};
9797
const decimal128_fast val {compliant_val};
9898
return val;
9999
}
100100

101101
#ifdef BOOST_DECIMAL_HAS_INT128
102-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128f(detail::uint128_t bits) noexcept -> decimal128_fast
102+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128f(detail::builtin_uint128_t bits) noexcept -> decimal128_fast
103103
{
104104
const auto compliant_val {from_bid_d128(bits)};
105105
const decimal128_fast val {compliant_val};
@@ -127,12 +127,12 @@ BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal64_fast val) noexcept -> std::
127127
return to_bid_d64f(val);
128128
}
129129

130-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal128 val) noexcept -> uint128
130+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal128 val) noexcept -> int128::uint128_t
131131
{
132132
return to_bid_d128(val);
133133
}
134134

135-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal128_fast val) noexcept -> uint128
135+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal128_fast val) noexcept -> int128::uint128_t
136136
{
137137
return to_bid_d128f(val);
138138
}
@@ -170,14 +170,14 @@ constexpr auto from_bid<decimal64>(std::uint64_t bits) noexcept -> decimal64
170170
}
171171

172172
BOOST_DECIMAL_EXPORT template <typename T = decimal128_fast>
173-
constexpr auto from_bid(uint128 bits) noexcept
173+
constexpr auto from_bid(int128::uint128_t bits) noexcept
174174
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, T)
175175
{
176176
return from_bid_d128f(bits);
177177
}
178178

179179
BOOST_DECIMAL_EXPORT template <>
180-
constexpr auto from_bid<decimal128>(uint128 bits) noexcept -> decimal128
180+
constexpr auto from_bid<decimal128>(int128::uint128_t bits) noexcept -> decimal128
181181
{
182182
return from_bid_d128(bits);
183183
}

include/boost/decimal/charconv.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <boost/decimal/detail/config.hpp>
1515
#include <boost/decimal/detail/parser.hpp>
1616
#include <boost/decimal/detail/utilities.hpp>
17-
#include <boost/decimal/detail/emulated128.hpp>
17+
#include <boost/int128.hpp>
1818
#include <boost/decimal/detail/from_chars_result.hpp>
1919
#include <boost/decimal/detail/chars_format.hpp>
2020
#include <boost/decimal/detail/concepts.hpp>
@@ -51,7 +51,7 @@ constexpr auto from_chars_general_impl(const char* first, const char* last, Targ
5151
{
5252
using significand_type = std::conditional_t<(std::numeric_limits<typename TargetDecimalType::significand_type>::digits >
5353
std::numeric_limits<std::uint64_t>::digits),
54-
detail::uint128, std::uint64_t>;
54+
int128::uint128_t, std::uint64_t>;
5555

5656
if (first >= last)
5757
{
@@ -291,7 +291,7 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_scientific_impl(char* first, char* last, c
291291

292292
using uint_type = std::conditional_t<(std::numeric_limits<typename TargetDecimalType::significand_type>::digits >
293293
std::numeric_limits<std::uint64_t>::digits),
294-
detail::uint128, std::uint64_t>;
294+
int128::uint128_t, std::uint64_t>;
295295

296296
// Since frexp10 normalizes the value we by default know the number of digits in the significand
297297
auto significand_digits = std::numeric_limits<TargetDecimalType>::digits;
@@ -525,7 +525,7 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_fixed_impl(char* first, char* last, const
525525
first += num_leading_zeros;
526526

527527
// We can skip the rest if there's nothing more to do for the required precision
528-
if (significand == 0)
528+
if (significand == 0U)
529529
{
530530
if (precision - num_leading_zeros > 0)
531531
{
@@ -542,7 +542,7 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_fixed_impl(char* first, char* last, const
542542

543543
using uint_type = std::conditional_t<(std::numeric_limits<typename TargetDecimalType::significand_type>::digits >
544544
std::numeric_limits<std::uint64_t>::digits),
545-
detail::uint128, std::uint64_t>;
545+
int128::uint128_t, std::uint64_t>;
546546

547547
auto r = to_chars_integer_impl<uint_type, uint_type>(first, last, significand, 10);
548548

@@ -656,7 +656,7 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_hex_impl(char* first, char* last, const Ta
656656
{
657657
using Unsigned_Integer = std::conditional_t<(std::numeric_limits<typename TargetDecimalType::significand_type>::digits >
658658
std::numeric_limits<std::uint64_t>::digits),
659-
detail::uint128, std::uint64_t>;
659+
int128::uint128_t, std::uint64_t>;
660660

661661
if (signbit(value))
662662
{
@@ -684,7 +684,7 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_hex_impl(char* first, char* last, const Ta
684684

685685
int exp {};
686686
Unsigned_Integer significand = frexp10(value, &exp);
687-
BOOST_DECIMAL_ASSERT(significand != 0);
687+
BOOST_DECIMAL_ASSERT(significand != 0U);
688688
// Strip zeros of the significand since frexp10 normalizes it
689689
const auto zero_removal {detail::remove_trailing_zeros(significand)};
690690
significand = zero_removal.trimmed_number;
@@ -706,7 +706,7 @@ BOOST_DECIMAL_CONSTEXPR auto to_chars_hex_impl(char* first, char* last, const Ta
706706

707707
if (significand_digits > precision + 1)
708708
{
709-
const auto trailing_digit = significand & 0xF;
709+
const auto trailing_digit = static_cast<std::uint32_t>(significand & 0xFU);
710710
significand >>= 4;
711711
++exp;
712712
if (trailing_digit >= 8)

include/boost/decimal/cstdlib.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <boost/decimal/detail/config.hpp>
1515
#include <boost/decimal/detail/parser.hpp>
1616
#include <boost/decimal/detail/utilities.hpp>
17-
#include <boost/decimal/detail/emulated128.hpp>
17+
#include <boost/int128.hpp>
1818
#include <boost/decimal/detail/locale_conversion.hpp>
1919

2020
#ifndef BOOST_DECIMAL_BUILD_MODULE
@@ -39,7 +39,7 @@ inline auto strtod_calculation(const char* str, char** endptr, char* buffer, std
3939
{
4040
using significand_type = std::conditional_t<(std::numeric_limits<typename TargetDecimalType::significand_type>::digits >
4141
std::numeric_limits<std::uint64_t>::digits),
42-
detail::uint128, std::uint64_t>;
42+
int128::uint128_t, std::uint64_t>;
4343

4444
std::memcpy(buffer, str, str_length);
4545
convert_string_to_c_locale(buffer);

0 commit comments

Comments
 (0)