1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 11:56:40 +00:00

sf: correct size calculation for In/OutArray

This commit is contained in:
Michael Scire 2019-12-08 12:35:07 -08:00
parent 7472bc1c7f
commit 255e46e6d2

View file

@ -96,8 +96,9 @@ namespace ams::sf {
return this->pas.GetAddress(); return this->pas.GetAddress();
} }
constexpr size_t GetSizeImpl() const { template<typename Entry>
return this->pas.GetSize(); constexpr inline size_t GetSizeImpl() const {
return this->pas.GetSize() / sizeof(Entry);
} }
public: public:
constexpr BufferBase() : pas() { /* ... */ } constexpr BufferBase() : pas() { /* ... */ }
@ -153,7 +154,7 @@ namespace ams::sf {
} }
constexpr size_t GetSize() const { constexpr size_t GetSize() const {
return this->GetSizeImpl(); return this->GetSizeImpl<u8>();
} }
}; };
@ -177,7 +178,7 @@ namespace ams::sf {
} }
constexpr size_t GetSize() const { constexpr size_t GetSize() const {
return this->GetSizeImpl(); return this->GetSizeImpl<u8>();
} }
}; };
@ -200,7 +201,7 @@ namespace ams::sf {
} }
constexpr size_t GetSize() const { constexpr size_t GetSize() const {
return this->GetSizeImpl(); return this->GetSizeImpl<T>();
} }
constexpr const T &operator[](size_t i) const { constexpr const T &operator[](size_t i) const {
@ -227,7 +228,7 @@ namespace ams::sf {
} }
constexpr size_t GetSize() const { constexpr size_t GetSize() const {
return this->GetSizeImpl(); return this->GetSizeImpl<T>();
} }
constexpr T &operator[](size_t i) const { constexpr T &operator[](size_t i) const {