summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-27 19:48:51 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-27 19:48:51 -0400
commit91847f04a552098883541d2c4ab5d0a05120c8f5 (patch)
treea4866a4e9972c6d0cb816d74f77205351eb1c993 /include
parent115fe1992e2c50fd108f7bc7cc31d7d2b1f5c6b8 (diff)
TArray: Add some extra functions
Diffstat (limited to 'include')
-rw-r--r--include/pso/TArray.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/pso/TArray.h b/include/pso/TArray.h
index fb7a903..29dc01e 100644
--- a/include/pso/TArray.h
+++ b/include/pso/TArray.h
@@ -27,15 +27,33 @@ public:
return m_data[i];
};
+ T *start() {
+ return m_data;
+ };
+
+ T *end() {
+ return &m_data[size()-1];
+ };
+
template<typename T2>
T2 *as() {
return reinterpret_cast<T2 *>(m_data);
};
+ template<typename T2>
+ TArray<T2, (n * sizeof(T))/sizeof(T2)> &to() {
+ typedef TArray<T2, sizeof(m_data)/sizeof(T2)> to_type;
+ return reinterpret_cast<to_type &>(*this);
+ };
+
u8 *as_bytes() {
return reinterpret_cast<u8 *>(m_data);
};
+ void fill(u8 val) {
+ memset(m_data, val, byte_size());
+ };
+
void fill_with(u8 val) {
_fill_with<false>(val);
};