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