Skip to content

Commit ab510a9

Browse files
committed
replace map with vector to compat simplestl
1 parent fe99fdb commit ab510a9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/cpu.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ static void initialize_cpu_thread_affinity_mask(ncnn::CpuSet& mask_all, ncnn::Cp
15841584
}
15851585

15861586
// A map from processor number to whether it is an E core
1587-
std::vector<bool> processorCoreType(g_cpucount, false);
1587+
std::vector<std::pair<DWORD,bool>> processorCoreType;
15881588
BYTE maxEfficiencyClass = 0; // In a system without E cores, all cores EfficiencyClass is 0
15891589

15901590
BYTE* ptr = buffer.data();
@@ -1601,7 +1601,7 @@ static void initialize_cpu_thread_affinity_mask(ncnn::CpuSet& mask_all, ncnn::Cp
16011601
for (int bit = 0; bit < 64; ++bit) { // for each bit in the mask
16021602
if (mask & (static_cast<KAFFINITY>(1) << bit)) {
16031603
DWORD processorNumber = group * 64 + bit;
1604-
processorCoreType[processorNumber] = isECore;
1604+
processorCoreType.push_back(std::pair<DWORD,bool>(processorNumber, isECore));
16051605
}
16061606
}
16071607
}
@@ -1616,7 +1616,16 @@ static void initialize_cpu_thread_affinity_mask(ncnn::CpuSet& mask_all, ncnn::Cp
16161616
}
16171617
else {
16181618
for (int i = 0; i < g_cpucount; i++) {
1619-
if (processorCoreType[i]) {
1619+
bool isECore = false;
1620+
for (auto& p : processorCoreType) {
1621+
if (p.first == i) {
1622+
isECore = p.second;
1623+
break;
1624+
}
1625+
}
1626+
// fprintf(stderr, "processor %d is %s\n", i, isECore ? "E" : "P");
1627+
1628+
if (isECore) {
16201629
mask_little.enable(i);
16211630
}
16221631
else {

0 commit comments

Comments
 (0)