mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 07:27:39 +00:00
Minor dynamic_bitset changes
This commit is contained in:
parent
b791dc5e1a
commit
c6dcff0ae7
@ -94,8 +94,15 @@ public:
|
|||||||
}
|
}
|
||||||
return slot_list[slot][index];
|
return slot_list[slot][index];
|
||||||
}
|
}
|
||||||
|
bool operator[] (size_t pos) const {
|
||||||
|
size_t slot = pos / slot_size;
|
||||||
|
size_t index = pos % slot_size;
|
||||||
|
return slot_list.size() > slot && slot_list[slot][index];
|
||||||
|
}
|
||||||
size_t slots() const { return slot_list.size(); }
|
size_t slots() const { return slot_list.size(); }
|
||||||
slot_type get_slot(size_t slot) const { return slot_list[slot].to_ulong(); }
|
slot_type get_slot(size_t slot) const {
|
||||||
|
return slot_list.size() > slot ? slot_list[slot].to_ulong() : 0ul;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
std::vector<slot_bits> slot_list;
|
std::vector<slot_bits> slot_list;
|
||||||
};
|
};
|
||||||
|
@ -498,11 +498,8 @@ void HookContext::nativeForkSystemServer_pre() {
|
|||||||
|
|
||||||
// Send the bitset of module status back to magiskd from system_server
|
// Send the bitset of module status back to magiskd from system_server
|
||||||
dynamic_bitset bits;
|
dynamic_bitset bits;
|
||||||
// Pre-allocate enough bits
|
for (const auto &m : modules)
|
||||||
bits[module_fds.size() - 1] = false;
|
|
||||||
for (const auto &m : modules) {
|
|
||||||
bits[m.getId()] = true;
|
bits[m.getId()] = true;
|
||||||
}
|
|
||||||
write_int(fd, bits.slots());
|
write_int(fd, bits.slots());
|
||||||
for (int i = 0; i < bits.slots(); ++i) {
|
for (int i = 0; i < bits.slots(); ++i) {
|
||||||
auto l = bits.get_slot(i);
|
auto l = bits.get_slot(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user