Skip to content

Commit 3c56044

Browse files
committed
Conversions const
1 parent a38831e commit 3c56044

File tree

4 files changed

+54
-54
lines changed

4 files changed

+54
-54
lines changed

include/boost/decimal/bid_conversion.hpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,162 +22,162 @@ namespace decimal {
2222
# pragma GCC diagnostic ignored "-Wconversion"
2323
#endif
2424

25-
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d32(decimal32_t val) noexcept -> std::uint32_t
25+
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d32(const decimal32_t val) noexcept -> std::uint32_t
2626
{
2727
return val.bits_;
2828
}
2929

30-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d32(std::uint32_t bits) noexcept -> decimal32_t
30+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d32(const std::uint32_t bits) noexcept -> decimal32_t
3131
{
3232
return from_bits(bits);
3333
}
3434

35-
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d32f(decimal_fast32_t val) noexcept -> std::uint32_t
35+
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d32f(const decimal_fast32_t val) noexcept -> std::uint32_t
3636
{
3737
const decimal32_t compliant_val {val};
3838
return to_bid_d32(compliant_val);
3939
}
4040

41-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d32f(std::uint32_t bits) noexcept -> decimal_fast32_t
41+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d32f(const std::uint32_t bits) noexcept -> decimal_fast32_t
4242
{
4343
const auto compliant_val {from_bid_d32(bits)};
4444
const decimal_fast32_t val {compliant_val};
4545
return val;
4646
}
4747

48-
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d64(decimal64_t val) noexcept -> std::uint64_t
48+
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d64(const decimal64_t val) noexcept -> std::uint64_t
4949
{
5050
return val.bits_;
5151
}
5252

53-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d64(std::uint64_t bits) noexcept -> decimal64_t
53+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d64(const std::uint64_t bits) noexcept -> decimal64_t
5454
{
5555
return from_bits(bits);
5656
}
5757

58-
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d64f(decimal_fast64_t val) noexcept -> std::uint64_t
58+
BOOST_DECIMAL_EXPORT constexpr auto to_bid_d64f(const decimal_fast64_t val) noexcept -> std::uint64_t
5959
{
6060
const decimal64_t compliant_val {val};
6161
return to_bid_d64(compliant_val);
6262
}
6363

64-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d64f(std::uint64_t bits) noexcept -> decimal_fast64_t
64+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d64f(const std::uint64_t bits) noexcept -> decimal_fast64_t
6565
{
6666
const auto compliant_val {from_bid_d64(bits)};
6767
const decimal_fast64_t val {compliant_val};
6868
return val;
6969
}
7070

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

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

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

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

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

101101
#ifdef BOOST_DECIMAL_HAS_INT128
102-
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128f(detail::builtin_uint128_t bits) noexcept -> decimal_fast128_t
102+
BOOST_DECIMAL_EXPORT constexpr auto from_bid_d128f(const detail::builtin_uint128_t bits) noexcept -> decimal_fast128_t
103103
{
104104
const auto compliant_val {from_bid_d128(bits)};
105105
const decimal_fast128_t val {compliant_val};
106106
return val;
107107
}
108108
#endif
109109

110-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal32_t val) noexcept -> std::uint32_t
110+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(const decimal32_t val) noexcept -> std::uint32_t
111111
{
112112
return to_bid_d32(val);
113113
}
114114

115-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal_fast32_t val) noexcept -> std::uint32_t
115+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(const decimal_fast32_t val) noexcept -> std::uint32_t
116116
{
117117
return to_bid_d32f(val);
118118
}
119119

120-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal64_t val) noexcept -> std::uint64_t
120+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(const decimal64_t val) noexcept -> std::uint64_t
121121
{
122122
return to_bid_d64(val);
123123
}
124124

125-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal_fast64_t val) noexcept -> std::uint64_t
125+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(const decimal_fast64_t val) noexcept -> std::uint64_t
126126
{
127127
return to_bid_d64f(val);
128128
}
129129

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

135-
BOOST_DECIMAL_EXPORT constexpr auto to_bid(decimal_fast128_t val) noexcept -> int128::uint128_t
135+
BOOST_DECIMAL_EXPORT constexpr auto to_bid(const decimal_fast128_t& val) noexcept -> int128::uint128_t
136136
{
137137
return to_bid_d128f(val);
138138
}
139139

140140
BOOST_DECIMAL_EXPORT template <typename T>
141-
constexpr auto to_bid(T val) noexcept
141+
constexpr auto to_bid(const T val) noexcept
142142
{
143143
return to_bid(val);
144144
}
145145

146146
BOOST_DECIMAL_EXPORT template <typename T = decimal32_t>
147-
constexpr auto from_bid(std::uint32_t bits) noexcept
147+
constexpr auto from_bid(const std::uint32_t bits) noexcept
148148
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, T)
149149
{
150150
return from_bid_d32(bits);
151151
}
152152

153153
BOOST_DECIMAL_EXPORT template <>
154-
constexpr auto from_bid<decimal_fast32_t>(std::uint32_t bits) noexcept -> decimal_fast32_t
154+
constexpr auto from_bid<decimal_fast32_t>(const std::uint32_t bits) noexcept -> decimal_fast32_t
155155
{
156156
return from_bid_d32f(bits);
157157
}
158158

159159
BOOST_DECIMAL_EXPORT template <typename T = decimal64_t>
160-
constexpr auto from_bid(std::uint64_t bits) noexcept
160+
constexpr auto from_bid(const std::uint64_t bits) noexcept
161161
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, T)
162162
{
163163
return from_bid_d64(bits);
164164
}
165165

166166
BOOST_DECIMAL_EXPORT template <>
167-
constexpr auto from_bid<decimal_fast64_t>(std::uint64_t bits) noexcept -> decimal_fast64_t
167+
constexpr auto from_bid<decimal_fast64_t>(const std::uint64_t bits) noexcept -> decimal_fast64_t
168168
{
169169
return from_bid_d64f(bits);
170170
}
171171

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

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

include/boost/decimal/cstdio.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct parameters
5353

5454
inline auto parse_format(const char* format) -> parameters
5555
{
56-
// If the format is unspecified or incorrect we will use this as the default values
56+
// If the format is unspecified or incorrect, we will use this as the default values
5757
parameters params {6, chars_format::general, decimal_type::decimal64_t, false};
5858

5959
auto iter {format + 1};
@@ -155,7 +155,7 @@ inline void make_uppercase(char* first, const char* last) noexcept
155155
}
156156

157157
template <typename... T>
158-
inline auto snprintf_impl(char* buffer, std::size_t buf_size, const char* format, T... values) noexcept
158+
inline auto snprintf_impl(char* buffer, const std::size_t buf_size, const char* format, const T... values) noexcept
159159
#ifndef BOOST_DECIMAL_HAS_CONCEPTS
160160
-> std::enable_if_t<detail::conjunction_v<detail::is_decimal_floating_point<T>...>, int>
161161
#else
@@ -244,7 +244,7 @@ inline auto snprintf_impl(char* buffer, std::size_t buf_size, const char* format
244244
} // namespace detail
245245

246246
template <typename... T>
247-
inline auto snprintf(char* buffer, std::size_t buf_size, const char* format, T... values) noexcept
247+
inline auto snprintf(char* buffer, const std::size_t buf_size, const char* format, const T... values) noexcept
248248
#ifndef BOOST_DECIMAL_HAS_CONCEPTS
249249
-> std::enable_if_t<detail::conjunction_v<detail::is_decimal_floating_point<T>...>, int>
250250
#else
@@ -255,7 +255,7 @@ inline auto snprintf(char* buffer, std::size_t buf_size, const char* format, T..
255255
}
256256

257257
template <typename... T>
258-
inline auto fprintf(std::FILE* buffer, const char* format, T... values) noexcept
258+
inline auto fprintf(std::FILE* buffer, const char* format, const T... values) noexcept
259259
#ifndef BOOST_DECIMAL_HAS_CONCEPTS
260260
-> std::enable_if_t<detail::conjunction_v<detail::is_decimal_floating_point<T>...>, int>
261261
#else
@@ -306,7 +306,7 @@ inline auto fprintf(std::FILE* buffer, const char* format, T... values) noexcept
306306
}
307307

308308
template <typename... T>
309-
inline auto printf(const char* format, T... values) noexcept
309+
inline auto printf(const char* format, const T... values) noexcept
310310
#ifndef BOOST_DECIMAL_HAS_CONCEPTS
311311
-> std::enable_if_t<detail::conjunction_v<detail::is_decimal_floating_point<T>...>, int>
312312
#else

include/boost/decimal/cstdlib.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace detail {
3535

3636
// 3.8.2
3737
template <typename TargetDecimalType>
38-
inline auto strtod_calculation(const char* str, char** endptr, char* buffer, std::size_t str_length) noexcept -> TargetDecimalType
38+
inline auto strtod_calculation(const char* str, char** endptr, char* buffer, const std::size_t str_length) noexcept -> TargetDecimalType
3939
{
4040
using significand_type = std::conditional_t<(std::numeric_limits<typename TargetDecimalType::significand_type>::digits >
4141
std::numeric_limits<std::uint64_t>::digits),
@@ -123,7 +123,7 @@ inline auto strtod_impl(const char* str, char** endptr) noexcept -> TargetDecima
123123

124124
// 3.9.2
125125
template <typename TargetDecimalType>
126-
inline auto wcstod_calculation(const wchar_t* str, wchar_t** endptr, char* buffer, std::size_t str_length) noexcept -> TargetDecimalType
126+
inline auto wcstod_calculation(const wchar_t* str, wchar_t** endptr, char* buffer, const std::size_t str_length) noexcept -> TargetDecimalType
127127
{
128128
// Convert all the characters from wchar_t to char and use regular strtod32
129129
for (std::size_t i {}; i < str_length; ++i)

0 commit comments

Comments
 (0)