summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-04-05 15:28:08 -0400
committerGravatar Lioncash2019-04-05 15:29:40 -0400
commit33db37e66923ef90a4071910eea06c79c077cc15 (patch)
tree14a21c505a63fa378be2cc2391c9250f395fdcdd /src
parentMerge pull request #2282 from bunnei/gpu-asynch-v2 (diff)
downloadyuzu-33db37e66923ef90a4071910eea06c79c077cc15.tar.gz
yuzu-33db37e66923ef90a4071910eea06c79c077cc15.tar.xz
yuzu-33db37e66923ef90a4071910eea06c79c077cc15.zip
common/bit_util: Make CountLeading/CountTrailing functions have the same return types
Makes the return type consistently uniform (like the intrinsics we're wrapping). This also conveniently silences a truncation warning within the kernel multi_level_queue.
Diffstat (limited to 'src')
-rw-r--r--src/common/bit_util.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/bit_util.h b/src/common/bit_util.h
index a4f9ed4aa..d032df413 100644
--- a/src/common/bit_util.h
+++ b/src/common/bit_util.h
@@ -32,7 +32,7 @@ inline u32 CountLeadingZeroes32(u32 value) {
32 return 32; 32 return 32;
33} 33}
34 34
35inline u64 CountLeadingZeroes64(u64 value) { 35inline u32 CountLeadingZeroes64(u64 value) {
36 unsigned long leading_zero = 0; 36 unsigned long leading_zero = 0;
37 37
38 if (_BitScanReverse64(&leading_zero, value) != 0) { 38 if (_BitScanReverse64(&leading_zero, value) != 0) {
@@ -47,15 +47,15 @@ inline u32 CountLeadingZeroes32(u32 value) {
47 return 32; 47 return 32;
48 } 48 }
49 49
50 return __builtin_clz(value); 50 return static_cast<u32>(__builtin_clz(value));
51} 51}
52 52
53inline u64 CountLeadingZeroes64(u64 value) { 53inline u32 CountLeadingZeroes64(u64 value) {
54 if (value == 0) { 54 if (value == 0) {
55 return 64; 55 return 64;
56 } 56 }
57 57
58 return __builtin_clzll(value); 58 return static_cast<u32>(__builtin_clzll(value));
59} 59}
60#endif 60#endif
61 61
@@ -70,7 +70,7 @@ inline u32 CountTrailingZeroes32(u32 value) {
70 return 32; 70 return 32;
71} 71}
72 72
73inline u64 CountTrailingZeroes64(u64 value) { 73inline u32 CountTrailingZeroes64(u64 value) {
74 unsigned long trailing_zero = 0; 74 unsigned long trailing_zero = 0;
75 75
76 if (_BitScanForward64(&trailing_zero, value) != 0) { 76 if (_BitScanForward64(&trailing_zero, value) != 0) {
@@ -85,15 +85,15 @@ inline u32 CountTrailingZeroes32(u32 value) {
85 return 32; 85 return 32;
86 } 86 }
87 87
88 return __builtin_ctz(value); 88 return static_cast<u32>(__builtin_ctz(value));
89} 89}
90 90
91inline u64 CountTrailingZeroes64(u64 value) { 91inline u32 CountTrailingZeroes64(u64 value) {
92 if (value == 0) { 92 if (value == 0) {
93 return 64; 93 return 64;
94 } 94 }
95 95
96 return __builtin_ctzll(value); 96 return static_cast<u32>(__builtin_ctzll(value));
97} 97}
98#endif 98#endif
99 99