This commit is contained in:
aozhiwei 2024-09-05 16:46:35 +08:00
parent 0c7047a18b
commit d1a289b78d

View File

@ -18,6 +18,7 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
list_head list_entry;
int attr_id;
float value;
float finaly_value;
int source_type = kAstNone;
std::shared_ptr<AttrAddition> holder;
std::shared_ptr<std::function<std::string()>> get_source;
@ -45,29 +46,42 @@ static std::array<std::vector<std::shared_ptr<AttrAddition>>, kAstEnd> s_speed_r
static float CalcSpeedRateIn(list_head* head)
{
list_head* pos = nullptr;
list_head* next = nullptr;
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
switch (e->source_type) {
case kAstChip:
{
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
}
break;
default:
{
if (e->source_type >= 0 && e->source_type <= s_speed_ratein_list.size()) {
{
list_head* pos = nullptr;
list_head* next = nullptr;
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
switch (e->source_type) {
case kAstChip:
{
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
}
break;
default:
{
if (e->source_type >= 0 && e->source_type <= s_speed_ratein_list.size()) {
s_speed_ratein_list.at(e->source_type).push_back(e->holder);
}
}
break;
}
break;
}
}
for (auto& itr : s_speed_ratein_list) {
itr.clear();
{
for (auto& itr : s_speed_ratein_list) {
std::sort(itr.begin(), itr.end(),
[] (std::shared_ptr<AttrAddition> a, std::shared_ptr<AttrAddition> b) -> bool
{
return std::fabs(a->value) > std::fabs(b->value);
});
}
}
{
for (auto& itr : s_speed_ratein_list) {
itr.clear();
}
}
return 0.0f;
}