ams: replace most remaining operator & with std::addressof
This commit is contained in:
@@ -200,23 +200,23 @@ namespace ams::util {
|
||||
}
|
||||
|
||||
ALWAYS_INLINE iterator end() {
|
||||
return iterator(&this->root_node);
|
||||
return iterator(std::addressof(this->root_node));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const_iterator end() const {
|
||||
return const_iterator(&this->root_node);
|
||||
return const_iterator(std::addressof(this->root_node));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE iterator iterator_to(reference v) {
|
||||
/* Only allow iterator_to for values in lists. */
|
||||
AMS_ASSERT(v.IsLinked());
|
||||
return iterator(&v);
|
||||
return iterator(std::addressof(v));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const_iterator iterator_to(const_reference v) const {
|
||||
/* Only allow iterator_to for values in lists. */
|
||||
AMS_ASSERT(v.IsLinked());
|
||||
return const_iterator(&v);
|
||||
return const_iterator(std::addressof(v));
|
||||
}
|
||||
|
||||
/* Content management. */
|
||||
@@ -245,11 +245,11 @@ namespace ams::util {
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void push_back(reference node) {
|
||||
this->root_node.LinkPrev(&node);
|
||||
this->root_node.LinkPrev(std::addressof(node));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void push_front(reference node) {
|
||||
this->root_node.LinkNext(&node);
|
||||
this->root_node.LinkNext(std::addressof(node));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void pop_back() {
|
||||
@@ -261,8 +261,8 @@ namespace ams::util {
|
||||
}
|
||||
|
||||
ALWAYS_INLINE iterator insert(const_iterator pos, reference node) {
|
||||
pos.GetNonConstIterator()->LinkPrev(&node);
|
||||
return iterator(&node);
|
||||
pos.GetNonConstIterator()->LinkPrev(std::addressof(node));
|
||||
return iterator(std::addressof(node));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void splice(const_iterator pos, IntrusiveListImpl &o) {
|
||||
@@ -303,8 +303,8 @@ namespace ams::util {
|
||||
iterator pos(_pos.GetNonConstIterator());
|
||||
iterator first(_first.GetNonConstIterator());
|
||||
iterator last(_last.GetNonConstIterator());
|
||||
first->Unlink(&*last);
|
||||
pos->SplicePrev(&*first, &*first);
|
||||
first->Unlink(std::addressof(*last));
|
||||
pos->SplicePrev(std::addressof(*first), std::addressof(*first));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -362,7 +362,7 @@ namespace ams::util {
|
||||
}
|
||||
|
||||
ALWAYS_INLINE pointer operator->() const {
|
||||
return &Traits::GetParent(*this->iterator);
|
||||
return std::addressof(Traits::GetParent(*this->iterator));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE reference operator*() const {
|
||||
@@ -562,11 +562,11 @@ namespace ams::util {
|
||||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE Derived &GetParent(IntrusiveListNode &node) {
|
||||
return util::GetParentReference<Member, Derived>(&node);
|
||||
return util::GetParentReference<Member, Derived>(std::addressof(node));
|
||||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE Derived const &GetParent(IntrusiveListNode const &node) {
|
||||
return util::GetParentReference<Member, Derived>(&node);
|
||||
return util::GetParentReference<Member, Derived>(std::addressof(node));
|
||||
}
|
||||
private:
|
||||
static constexpr TypedStorage<Derived> DerivedStorage = {};
|
||||
@@ -597,11 +597,11 @@ namespace ams::util {
|
||||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE Derived &GetParent(IntrusiveListNode &node) {
|
||||
return util::GetParentReference<Member, Derived>(&node);
|
||||
return util::GetParentReference<Member, Derived>(std::addressof(node));
|
||||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE Derived const &GetParent(IntrusiveListNode const &node) {
|
||||
return util::GetParentReference<Member, Derived>(&node);
|
||||
return util::GetParentReference<Member, Derived>(std::addressof(node));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -130,14 +130,14 @@ namespace ams::util {
|
||||
{
|
||||
const int num_init_iterations = std::max(seed_count + 1, MinimumInitIterations) - 1;
|
||||
|
||||
GenerateInitialValuePlus(&this->state, 0, seed_count);
|
||||
GenerateInitialValuePlus(std::addressof(this->state), 0, seed_count);
|
||||
|
||||
for (int i = 0; i < num_init_iterations; i++) {
|
||||
GenerateInitialValuePlus(&this->state, (i + 1) % NumStateWords, (i < seed_count) ? seed[i] : 0);
|
||||
GenerateInitialValuePlus(std::addressof(this->state), (i + 1) % NumStateWords, (i < seed_count) ? seed[i] : 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < static_cast<int>(NumStateWords); i++) {
|
||||
GenerateInitialValueXor(&this->state, (i + 1 + num_init_iterations) % NumStateWords);
|
||||
GenerateInitialValueXor(std::addressof(this->state), (i + 1 + num_init_iterations) % NumStateWords);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace ams::util {
|
||||
/* Make sure we're aligned. */
|
||||
if (start < aligned_start) {
|
||||
const u32 rnd = this->GenerateRandomU32();
|
||||
std::memcpy(dst, &rnd, aligned_start - start);
|
||||
std::memcpy(dst, std::addressof(rnd), aligned_start - start);
|
||||
}
|
||||
|
||||
/* Write as many aligned u32s as we can. */
|
||||
@@ -179,7 +179,7 @@ namespace ams::util {
|
||||
/* Handle any leftover unaligned data. */
|
||||
if (aligned_end < end) {
|
||||
const u32 rnd = this->GenerateRandomU32();
|
||||
std::memcpy(reinterpret_cast<void *>(aligned_end), &rnd, end - aligned_end);
|
||||
std::memcpy(reinterpret_cast<void *>(aligned_end), std::addressof(rnd), end - aligned_end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ namespace ams::crypto::impl {
|
||||
if (!(power_1.IsValid() && power_2.IsValid() && power_3.IsValid())) {
|
||||
return false;
|
||||
}
|
||||
decltype(power_1)* powers[3] = { &power_1, &power_2, &power_3 };
|
||||
decltype(power_1)* powers[3] = { std::addressof(power_1), std::addressof(power_2), std::addressof(power_3) };
|
||||
|
||||
/* Set the powers of src. */
|
||||
Copy(power_1.GetBuffer(), src, mod_words);
|
||||
|
||||
@@ -68,13 +68,13 @@ namespace ams::dd {
|
||||
|
||||
if (hos::GetVersion() >= hos::Version_10_0_0) {
|
||||
svc::Size region_size = 0;
|
||||
R_TRY_CATCH(svc::QueryIoMapping(&virt_addr, ®ion_size, aligned_addr, aligned_size)) {
|
||||
R_TRY_CATCH(svc::QueryIoMapping(std::addressof(virt_addr), std::addressof(region_size), aligned_addr, aligned_size)) {
|
||||
/* Official software handles this by returning 0. */
|
||||
R_CATCH(svc::ResultNotFound) { return 0; }
|
||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||
AMS_ASSERT(region_size >= aligned_size);
|
||||
} else {
|
||||
R_TRY_CATCH(svc::LegacyQueryIoMapping(&virt_addr, aligned_addr, aligned_size)) {
|
||||
R_TRY_CATCH(svc::LegacyQueryIoMapping(std::addressof(virt_addr), aligned_addr, aligned_size)) {
|
||||
/* Official software handles this by returning 0. */
|
||||
R_CATCH(svc::ResultNotFound) { return 0; }
|
||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||
@@ -102,7 +102,7 @@ namespace ams::dd {
|
||||
|
||||
u32 ReadWritePmcRegisterImpl(dd::PhysicalAddress phys_addr, u32 value, u32 mask) {
|
||||
u32 out_value;
|
||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::AtmosphereReadWriteRegister(phys_addr, mask, value, &out_value)));
|
||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::AtmosphereReadWriteRegister(phys_addr, mask, value, std::addressof(out_value))));
|
||||
return out_value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user