diff options
| author | Hannes Schulze <hannes.hs.schulze@fau.de> | 2025-05-02 16:17:56 +0200 |
|---|---|---|
| committer | Hannes Schulze <hannes.hs.schulze@fau.de> | 2025-05-02 16:17:56 +0200 |
| commit | 850159dc9663a1cb0a7bb8f25fe1d426134ccabb (patch) | |
| tree | 122c61166f6589be1e15ef328388cbc2596f97f4 /lib/nes/common/containers | |
| parent | 91c9b3addf5f3db972fd28752855eda811221afe (diff) | |
implement file viewer
Diffstat (limited to 'lib/nes/common/containers')
| -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 |
