mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
More C-Style Cast Removal (#746)
This commit is contained in:
@@ -104,7 +104,7 @@ void barycentric_rational_imp<Real>::calculate_weights(size_t approximation_orde
|
||||
m_w.resize(n, 0);
|
||||
for(int64_t k = 0; k < n; ++k)
|
||||
{
|
||||
int64_t i_min = (std::max)(k - (int64_t) approximation_order, (int64_t) 0);
|
||||
int64_t i_min = (std::max)(k - static_cast<int64_t>(approximation_order), static_cast<int64_t>(0));
|
||||
int64_t i_max = k;
|
||||
if (k >= n - (std::ptrdiff_t)approximation_order)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ void vector_barycentric_rational_imp<TimeContainer, SpaceContainer>::calculate_w
|
||||
w_.resize(n, Real(0));
|
||||
for(int64_t k = 0; k < n; ++k)
|
||||
{
|
||||
int64_t i_min = (std::max)(k - (int64_t) approximation_order, (int64_t) 0);
|
||||
int64_t i_min = (std::max)(k - static_cast<int64_t>(approximation_order), static_cast<int64_t>(0));
|
||||
int64_t i_max = k;
|
||||
if (k >= n - (std::ptrdiff_t)approximation_order)
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
RandomNumberGenerator gen(seed);
|
||||
Real inv_denom = 1/static_cast<Real>(((gen.max)()-(gen.min)()));
|
||||
|
||||
m_num_threads = (std::max)(m_num_threads, (uint64_t) 1);
|
||||
m_num_threads = (std::max)(m_num_threads, static_cast<uint64_t>(1));
|
||||
m_thread_calls.reset(new std::atomic<uint64_t>[threads]);
|
||||
m_thread_Ss.reset(new std::atomic<Real>[threads]);
|
||||
m_thread_averages.reset(new std::atomic<Real>[threads]);
|
||||
|
||||
@@ -46,7 +46,7 @@ std::vector<Real> daubechies_scaling_dyadic_grid(int64_t j_max)
|
||||
std::vector<Real> v(2*p + (2*p-1)*((1<<j_max) -1), std::numeric_limits<Real>::quiet_NaN());
|
||||
v[0] = 0;
|
||||
v[v.size()-1] = 0;
|
||||
for (int64_t i = 0; i < (int64_t) phik.size(); ++i) {
|
||||
for (int64_t i = 0; i < static_cast<int64_t>(phik.size()); ++i) {
|
||||
v[i*(1uLL<<j_max)] = phik[i];
|
||||
}
|
||||
|
||||
@@ -58,19 +58,19 @@ std::vector<Real> daubechies_scaling_dyadic_grid(int64_t j_max)
|
||||
// Where this value will go:
|
||||
int64_t delivery_idx = k*(1uLL << (j_max-j));
|
||||
// This is a nice check, but we've tested this exhaustively, and it's an expensive check:
|
||||
//if (delivery_idx >= (int64_t) v.size()) {
|
||||
//if (delivery_idx >= static_cast<int64_t>(v.size())) {
|
||||
// std::cerr << "Delivery index out of range!\n";
|
||||
// continue;
|
||||
//}
|
||||
Real term = 0;
|
||||
for (int64_t l = 0; l < (int64_t) c.size(); ++l)
|
||||
for (int64_t l = 0; l < static_cast<int64_t>(c.size()); ++l)
|
||||
{
|
||||
int64_t idx = k*(int64_t(1) << (j_max - j + 1)) - l*(int64_t(1) << j_max);
|
||||
if (idx < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (idx < (int64_t) v.size())
|
||||
if (idx < static_cast<int64_t>(v.size()))
|
||||
{
|
||||
term += c[l]*v[idx];
|
||||
}
|
||||
|
||||
@@ -260,11 +260,11 @@ template<> struct fp_traits_non_native<double, double_precision>
|
||||
{
|
||||
typedef ieee_copy_all_bits_tag method;
|
||||
|
||||
static constexpr uint64_t sign = ((uint64_t)0x80000000u) << 32;
|
||||
static constexpr uint64_t exponent = ((uint64_t)0x7ff00000) << 32;
|
||||
static constexpr uint64_t sign = static_cast<uint64_t>(0x80000000u) << 32;
|
||||
static constexpr uint64_t exponent = static_cast<uint64_t>(0x7ff00000) << 32;
|
||||
static constexpr uint64_t flag = 0;
|
||||
static constexpr uint64_t significand
|
||||
= (((uint64_t)0x000fffff) << 32) + ((uint64_t)0xffffffffu);
|
||||
= (static_cast<uint64_t>(0x000fffff) << 32) + static_cast<uint64_t>(0xffffffffu);
|
||||
|
||||
typedef uint64_t bits;
|
||||
static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
|
||||
@@ -313,11 +313,11 @@ template<> struct fp_traits_non_native<long double, double_precision>
|
||||
{
|
||||
typedef ieee_copy_all_bits_tag method;
|
||||
|
||||
static const uint64_t sign = (uint64_t)0x80000000u << 32;
|
||||
static const uint64_t exponent = (uint64_t)0x7ff00000 << 32;
|
||||
static const uint64_t sign = static_cast<uint64_t>(0x80000000u) << 32;
|
||||
static const uint64_t exponent = static_cast<uint64_t>(0x7ff00000) << 32;
|
||||
static const uint64_t flag = 0;
|
||||
static const uint64_t significand
|
||||
= ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffffu;
|
||||
= (static_cast<uint64_t>(0x000fffff) << 32) + static_cast<uint64_t>(0xffffffffu);
|
||||
|
||||
typedef uint64_t bits;
|
||||
static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
|
||||
|
||||
@@ -38,7 +38,7 @@ void test_mode_2param(benchmark::State& state)
|
||||
|
||||
static void fixed_ratio_2args(benchmark::internal::Benchmark* b, long double left_div_right, std::vector<int64_t> lefts) {
|
||||
for (const long double &left: lefts) {
|
||||
b->Args({(int64_t)left, (int64_t)(left/left_div_right)});
|
||||
b->Args({static_cast<int64_t>(left), static_cast<int64_t>((left/left_div_right))});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user