summaryrefslogtreecommitdiff
path: root/src/video_core/textures/astc.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-03-13 22:26:48 -0300
committerGravatar ReinUsesLisp2020-03-13 22:26:48 -0300
commit835a3d09c67eb5a028e5594f64490135b7b423a4 (patch)
treed40a11e2c7223f31f795fa147b99a45a8112cd64 /src/video_core/textures/astc.cpp
parentastc: Use common types instead of stdint.h integer types (diff)
downloadyuzu-835a3d09c67eb5a028e5594f64490135b7b423a4.tar.gz
yuzu-835a3d09c67eb5a028e5594f64490135b7b423a4.tar.xz
yuzu-835a3d09c67eb5a028e5594f64490135b7b423a4.zip
astc: Move Popcnt to an anonymous namespace and make it constexpr
Diffstat (limited to 'src/video_core/textures/astc.cpp')
-rw-r--r--src/video_core/textures/astc.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp
index dcfab4dad..aba47a0e8 100644
--- a/src/video_core/textures/astc.cpp
+++ b/src/video_core/textures/astc.cpp
@@ -25,6 +25,19 @@
25 25
26#include "video_core/textures/astc.h" 26#include "video_core/textures/astc.h"
27 27
28namespace {
29
30/// Count the number of bits set in a number.
31constexpr u32 Popcnt(u32 n) {
32 u32 c = 0;
33 for (; n; c++) {
34 n &= n - 1;
35 }
36 return c;
37}
38
39} // Anonymous namespace
40
28class InputBitStream { 41class InputBitStream {
29public: 42public:
30 explicit InputBitStream(const unsigned char* ptr, int start_offset = 0) 43 explicit InputBitStream(const unsigned char* ptr, int start_offset = 0)
@@ -212,15 +225,6 @@ public:
212 return totalBits; 225 return totalBits;
213 } 226 }
214 227
215 // Count the number of bits set in a number.
216 static inline u32 Popcnt(u32 n) {
217 u32 c;
218 for (c = 0; n; c++) {
219 n &= n - 1;
220 }
221 return c;
222 }
223
224 // Returns a new instance of this struct that corresponds to the 228 // Returns a new instance of this struct that corresponds to the
225 // can take no more than maxval values 229 // can take no more than maxval values
226 static IntegerEncodedValue CreateEncoding(u32 maxVal) { 230 static IntegerEncodedValue CreateEncoding(u32 maxVal) {