1
0
Fork 0

core/memory: Make use of std::move in Entry::operator= (#5233)

* core/memory: Amend unusual return value of operator=

operator= usually returns a reference to this. Given there's no comment
explaining why void was used, this can be assumed to be an oversight.

* core/memory: Make use of std::move in Entry::operator=

Same behavior, minus the need for an atomic reference count increment
and decrement (since MemoryRef contains a std::shared_ptr).
This commit is contained in:
Mat M 2020-04-28 15:39:02 -04:00 committed by GitHub
parent 9dc0f38ffd
commit 96832a2c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -85,9 +85,10 @@ struct PageTable {
struct Entry {
Entry(Pointers& pointers_, VAddr idx_) : pointers(pointers_), idx(idx_) {}
void operator=(MemoryRef value) {
pointers.refs[idx] = value;
Entry& operator=(MemoryRef value) {
pointers.raw[idx] = value.GetPtr();
pointers.refs[idx] = std::move(value);
return *this;
}
operator u8*() {