diff options
Diffstat (limited to 'lib/nes/common/containers/span.hh')
| -rw-r--r-- | lib/nes/common/containers/span.hh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/nes/common/containers/span.hh b/lib/nes/common/containers/span.hh index 324d486..ec48622 100644 --- a/lib/nes/common/containers/span.hh +++ b/lib/nes/common/containers/span.hh @@ -85,6 +85,12 @@ namespace nes return span<T, OtherLength>{ data_ + first, OtherLength, {} }; } + template<typename U> + auto unsafe_bitcast() const -> span<U> + { + return span<U>{ reinterpret_cast<U*>(data_), static_cast<u32>(length_ / sizeof(U)) }; + } + auto operator[](u32 const index) const -> T& { NES_ASSERT(index < get_length() && "index out of bounds"); @@ -98,4 +104,4 @@ namespace nes { } }; -} // namespace nes
\ No newline at end of file +} // namespace nes |
