diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/TArray.h | 18 |
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); }; |