mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
netlist: minor code maintenance. (nw)
This commit is contained in:
parent
447ac5bccd
commit
2453c5b077
@ -311,7 +311,7 @@ namespace plib {
|
||||
m_stat_cur_alloc() -= size;
|
||||
#if (PUSE_ALIGNED_ALLOCATION)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc)
|
||||
free(ptr);
|
||||
::free(ptr);
|
||||
#else
|
||||
::operator delete(ptr);
|
||||
#endif
|
||||
|
@ -17,29 +17,29 @@
|
||||
namespace plib
|
||||
{
|
||||
|
||||
|
||||
template<typename T, typename A = aligned_allocator<T>>
|
||||
class pmatrix2d
|
||||
{
|
||||
public:
|
||||
using size_type = std::size_t;
|
||||
using value_type = T;
|
||||
using allocator_type = A;
|
||||
|
||||
static constexpr const std::size_t align_size = align_traits<A>::align_size;
|
||||
static constexpr const std::size_t stride_size = align_traits<A>::stride_size;
|
||||
pmatrix2d()
|
||||
static constexpr const size_type align_size = align_traits<A>::align_size;
|
||||
static constexpr const size_type stride_size = align_traits<A>::stride_size;
|
||||
pmatrix2d() noexcept
|
||||
: m_N(0), m_M(0), m_stride(8), m_v()
|
||||
{
|
||||
}
|
||||
|
||||
pmatrix2d(std::size_t N, std::size_t M)
|
||||
pmatrix2d(size_type N, size_type M)
|
||||
: m_N(N), m_M(M), m_v()
|
||||
{
|
||||
m_stride = ((M + stride_size-1) / stride_size) * stride_size;
|
||||
m_v.resize(N * m_stride);
|
||||
}
|
||||
|
||||
void resize(std::size_t N, std::size_t M)
|
||||
void resize(size_type N, size_type M)
|
||||
{
|
||||
m_N = N;
|
||||
m_M = M;
|
||||
@ -47,31 +47,31 @@ namespace plib
|
||||
m_v.resize(N * m_stride);
|
||||
}
|
||||
|
||||
C14CONSTEXPR T * operator[] (std::size_t row) noexcept
|
||||
C14CONSTEXPR T * operator[] (size_type row) noexcept
|
||||
{
|
||||
return assume_aligned_ptr<T, align_size>(&m_v[m_stride * row]);
|
||||
}
|
||||
|
||||
constexpr const T * operator[] (std::size_t row) const noexcept
|
||||
constexpr const T * operator[] (size_type row) const noexcept
|
||||
{
|
||||
return assume_aligned_ptr<T, align_size>(&m_v[m_stride * row]);
|
||||
}
|
||||
|
||||
T & operator()(std::size_t r, std::size_t c) noexcept
|
||||
T & operator()(size_type r, size_type c) noexcept
|
||||
{
|
||||
return (*this)[r][c];
|
||||
}
|
||||
|
||||
const T & operator()(std::size_t r, std::size_t c) const noexcept
|
||||
const T & operator()(size_type r, size_type c) const noexcept
|
||||
{
|
||||
return (*this)[r][c];
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::size_t m_N;
|
||||
std::size_t m_M;
|
||||
std::size_t m_stride;
|
||||
size_type m_N;
|
||||
size_type m_M;
|
||||
size_type m_stride;
|
||||
|
||||
std::vector<T, A> m_v;
|
||||
};
|
||||
|
@ -508,20 +508,18 @@ namespace solver
|
||||
|
||||
// FIXME: gonn, gtn and Idr - which float types should they have?
|
||||
|
||||
for (std::size_t i = 0; i < railstart; i++)
|
||||
*tcr_r[i] += static_cast<FT>(go[i]);
|
||||
|
||||
auto gtot_t = std::accumulate(gt, gt + term_count, plib::constants<FT>::zero());
|
||||
|
||||
// update diagonal element ...
|
||||
*tcr_r[railstart] += static_cast<FT>(gtot_t); //mat.A[mat.diag[k]] += gtot_t;
|
||||
*tcr_r[railstart] = static_cast<FT>(gtot_t); //mat.A[mat.diag[k]] += gtot_t;
|
||||
|
||||
auto RHS_t = std::accumulate(Idr, Idr + term_count, plib::constants<FT>::zero());
|
||||
for (std::size_t i = 0; i < railstart; i++)
|
||||
*tcr_r[i] += static_cast<FT>(go[i]);
|
||||
|
||||
auto RHS_t(std::accumulate(Idr, Idr + term_count, plib::constants<FT>::zero()));
|
||||
|
||||
for (std::size_t i = railstart; i < term_count; i++)
|
||||
{
|
||||
RHS_t += (- go[i]) * *cnV[i];
|
||||
}
|
||||
|
||||
m_RHS[k] = static_cast<FT>(RHS_t);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user