forked from premiere/premiere-libtorrent
Fix sizeof(X)/sizeof(T) and _countof (#1189)
https://msdn.microsoft.com/en-us/library/ms175773.aspx http://www.viva64.com/en/w/V651/print/
This commit is contained in:
parent
5c361715da
commit
af2a9a875b
|
@ -40,8 +40,7 @@ namespace libtorrent {
|
||||||
counters::counters()
|
counters::counters()
|
||||||
{
|
{
|
||||||
#ifdef ATOMIC_LLONG_LOCK_FREE
|
#ifdef ATOMIC_LLONG_LOCK_FREE
|
||||||
for (int i = 0; i < sizeof(m_stats_counter)
|
for (int i = 0; i < m_stats_counter.size(); ++i)
|
||||||
/ sizeof(m_stats_counter[0]); ++i)
|
|
||||||
m_stats_counter[i].store(0, std::memory_order_relaxed);
|
m_stats_counter[i].store(0, std::memory_order_relaxed);
|
||||||
#else
|
#else
|
||||||
memset(m_stats_counter, 0, sizeof(m_stats_counter));
|
memset(m_stats_counter, 0, sizeof(m_stats_counter));
|
||||||
|
@ -51,8 +50,7 @@ namespace libtorrent {
|
||||||
counters::counters(counters const& c)
|
counters::counters(counters const& c)
|
||||||
{
|
{
|
||||||
#ifdef ATOMIC_LLONG_LOCK_FREE
|
#ifdef ATOMIC_LLONG_LOCK_FREE
|
||||||
for (int i = 0; i < sizeof(m_stats_counter)
|
for (int i = 0; i < m_stats_counter.size(); ++i)
|
||||||
/ sizeof(m_stats_counter[0]); ++i)
|
|
||||||
m_stats_counter[i].store(
|
m_stats_counter[i].store(
|
||||||
c.m_stats_counter[i].load(std::memory_order_relaxed)
|
c.m_stats_counter[i].load(std::memory_order_relaxed)
|
||||||
, std::memory_order_relaxed);
|
, std::memory_order_relaxed);
|
||||||
|
@ -65,8 +63,7 @@ namespace libtorrent {
|
||||||
counters& counters::operator=(counters const& c)
|
counters& counters::operator=(counters const& c)
|
||||||
{
|
{
|
||||||
#ifdef ATOMIC_LLONG_LOCK_FREE
|
#ifdef ATOMIC_LLONG_LOCK_FREE
|
||||||
for (int i = 0; i < sizeof(m_stats_counter)
|
for (int i = 0; i < m_stats_counter.size(); ++i)
|
||||||
/ sizeof(m_stats_counter[0]); ++i)
|
|
||||||
m_stats_counter[i].store(
|
m_stats_counter[i].store(
|
||||||
c.m_stats_counter[i].load(std::memory_order_relaxed)
|
c.m_stats_counter[i].load(std::memory_order_relaxed)
|
||||||
, std::memory_order_relaxed);
|
, std::memory_order_relaxed);
|
||||||
|
|
Loading…
Reference in New Issue