diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-04-09 07:54:05 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-04-09 07:54:05 +0200 |
commit | d22a6892506395d7348f42c21288ab5ac9d7be5a (patch) | |
tree | 192e363dda9454ff494bc6062b35333767998d8f /src/video_core | |
parent | astc: OutputBitStream style changes and make it constexpr (diff) | |
download | yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.tar yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.tar.gz yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.tar.bz2 yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.tar.lz yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.tar.xz yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.tar.zst yuzu-d22a6892506395d7348f42c21288ab5ac9d7be5a.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/textures/astc.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index 20706bda0..91b4c5d7e 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp @@ -39,25 +39,25 @@ constexpr u32 Popcnt(u32 n) { class InputBitStream { public: - explicit InputBitStream(const u8* ptr, std::size_t start_offset = 0) - : cur_byte(ptr), next_bit(start_offset % 8) {} + constexpr explicit InputBitStream(const u8* ptr, std::size_t start_offset = 0) + : cur_byte{ptr}, next_bit{start_offset % 8} {} - std::size_t GetBitsRead() const { - return m_BitsRead; + constexpr std::size_t GetBitsRead() const { + return bits_read; } - u32 ReadBit() { - u32 bit = *cur_byte >> next_bit++; + constexpr bool ReadBit() { + const bool bit = (*cur_byte >> next_bit++) & 1; while (next_bit >= 8) { next_bit -= 8; cur_byte++; } - m_BitsRead++; - return bit & 1; + bits_read++; + return bit; } - u32 ReadBits(std::size_t nBits) { + constexpr u32 ReadBits(std::size_t nBits) { u32 ret = 0; for (std::size_t i = 0; i < nBits; ++i) { ret |= (ReadBit() & 1) << i; @@ -66,7 +66,7 @@ public: } template <std::size_t nBits> - u32 ReadBits() { + constexpr u32 ReadBits() { u32 ret = 0; for (std::size_t i = 0; i < nBits; ++i) { ret |= (ReadBit() & 1) << i; @@ -77,7 +77,7 @@ public: private: const u8* cur_byte; std::size_t next_bit = 0; - std::size_t m_BitsRead = 0; + std::size_t bits_read = 0; }; class OutputBitStream { |