Skip to content

Commit 6b6cd11

Browse files
committed
Use std::size_t instead of size_t
1 parent 648b1df commit 6b6cd11

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

src/CpuInfo.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void CpuInfo::init()
140140
cacheSizes{0, 0, 0, 0},
141141
cacheSharing{0, 0, 0, 0}
142142
{ }
143-
Array<size_t, 4> cacheSizes;
144-
Array<size_t, 4> cacheSharing;
143+
Array<std::size_t, 4> cacheSizes;
144+
Array<std::size_t, 4> cacheSharing;
145145
};
146146

147147
struct L1CacheInfo
@@ -380,17 +380,17 @@ namespace primesieve {
380380

381381
void CpuInfo::init()
382382
{
383-
auto logicalCpuCores = getSysctl<size_t>("hw.logicalcpu");
383+
auto logicalCpuCores = getSysctl<std::size_t>("hw.logicalcpu");
384384
if (!logicalCpuCores.empty())
385385
logicalCpuCores_ = logicalCpuCores[0];
386386

387387
// https://developer.apple.com/library/content/releasenotes/Performance/RN-AffinityAPI/index.html
388-
auto cacheSizes = getSysctl<size_t>("hw.cachesize");
388+
auto cacheSizes = getSysctl<std::size_t>("hw.cachesize");
389389
for (std::size_t i = 1; i < std::min(cacheSizes.size(), cacheSizes_.size()); i++)
390390
cacheSizes_[i] = cacheSizes[i];
391391

392392
// https://developer.apple.com/library/content/releasenotes/Performance/RN-AffinityAPI/index.html
393-
auto cacheConfig = getSysctl<size_t>("hw.cacheconfig");
393+
auto cacheConfig = getSysctl<std::size_t>("hw.cacheconfig");
394394
for (std::size_t i = 1; i < std::min(cacheConfig.size(), cacheSharing_.size()); i++)
395395
cacheSharing_[i] = cacheConfig[i];
396396
}
@@ -439,7 +439,7 @@ std::string getString(const std::string& filename)
439439
return {};
440440
}
441441

442-
size_t getValue(const std::string& filename)
442+
std::size_t getValue(const std::string& filename)
443443
{
444444
std::string str = getString(filename);
445445
std::size_t val = 0;
@@ -450,7 +450,7 @@ size_t getValue(const std::string& filename)
450450
return val;
451451
}
452452

453-
size_t getCacheSize(const std::string& filename)
453+
std::size_t getCacheSize(const std::string& filename)
454454
{
455455
std::string str = getString(filename);
456456
std::size_t val = 0;
@@ -562,7 +562,7 @@ std::vector<std::string> split(const std::string& str,
562562
/// Example: 0-8,18-26
563563
/// https://www.kernel.org/doc/Documentation/cputopology.txt
564564
///
565-
size_t parseThreadList(const std::string& filename)
565+
std::size_t parseThreadList(const std::string& filename)
566566
{
567567
std::size_t threads = 0;
568568
auto threadList = getString(filename);
@@ -590,7 +590,7 @@ size_t parseThreadList(const std::string& filename)
590590
/// Example: 00000000,00000000,00000000,07fc01ff
591591
/// https://www.kernel.org/doc/Documentation/cputopology.txt
592592
///
593-
size_t parseThreadMap(const std::string& filename)
593+
std::size_t parseThreadMap(const std::string& filename)
594594
{
595595
std::size_t threads = 0;
596596
std::string threadMap = getString(filename);
@@ -616,8 +616,8 @@ size_t parseThreadMap(const std::string& filename)
616616
/// But you cannot know in advance if any of these
617617
/// files exist, hence you need to try both.
618618
///
619-
size_t getThreads(const std::string& threadList,
620-
const std::string& threadMap)
619+
std::size_t getThreads(const std::string& threadList,
620+
const std::string& threadMap)
621621
{
622622
std::size_t threads = parseThreadList(threadList);
623623

@@ -639,7 +639,7 @@ void CpuInfo::init()
639639
using CacheSize_t = std::size_t;
640640
// Items must be sorted in ascending order
641641
std::map<CacheSize_t, std::size_t> l1CacheSizes;
642-
std::vector<size_t> cpuIds;
642+
std::vector<std::size_t> cpuIds;
643643
cpuIds.reserve(3);
644644

645645
// Based on my tests, for hybrid CPUs the Linux kernel always lists
@@ -781,37 +781,37 @@ std::string CpuInfo::cpuName() const
781781
}
782782
}
783783

784-
size_t CpuInfo::logicalCpuCores() const
784+
std::size_t CpuInfo::logicalCpuCores() const
785785
{
786786
return logicalCpuCores_;
787787
}
788788

789-
size_t CpuInfo::l1CacheBytes() const
789+
std::size_t CpuInfo::l1CacheBytes() const
790790
{
791791
return cacheSizes_[1];
792792
}
793793

794-
size_t CpuInfo::l2CacheBytes() const
794+
std::size_t CpuInfo::l2CacheBytes() const
795795
{
796796
return cacheSizes_[2];
797797
}
798798

799-
size_t CpuInfo::l3CacheBytes() const
799+
std::size_t CpuInfo::l3CacheBytes() const
800800
{
801801
return cacheSizes_[3];
802802
}
803803

804-
size_t CpuInfo::l1Sharing() const
804+
std::size_t CpuInfo::l1Sharing() const
805805
{
806806
return cacheSharing_[1];
807807
}
808808

809-
size_t CpuInfo::l2Sharing() const
809+
std::size_t CpuInfo::l2Sharing() const
810810
{
811811
return cacheSharing_[2];
812812
}
813813

814-
size_t CpuInfo::l3Sharing() const
814+
std::size_t CpuInfo::l3Sharing() const
815815
{
816816
return cacheSharing_[3];
817817
}

0 commit comments

Comments
 (0)