mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Merge pull request #2342 from lioncash/warning
common/multi_level_queue: Silence truncation warnings
This commit is contained in:
commit
fddafa14c8
2 changed files with 9 additions and 9 deletions
|
@ -32,7 +32,7 @@ inline u32 CountLeadingZeroes32(u32 value) {
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u64 CountLeadingZeroes64(u64 value) {
|
inline u32 CountLeadingZeroes64(u64 value) {
|
||||||
unsigned long leading_zero = 0;
|
unsigned long leading_zero = 0;
|
||||||
|
|
||||||
if (_BitScanReverse64(&leading_zero, value) != 0) {
|
if (_BitScanReverse64(&leading_zero, value) != 0) {
|
||||||
|
@ -47,15 +47,15 @@ inline u32 CountLeadingZeroes32(u32 value) {
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
return __builtin_clz(value);
|
return static_cast<u32>(__builtin_clz(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u64 CountLeadingZeroes64(u64 value) {
|
inline u32 CountLeadingZeroes64(u64 value) {
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
return __builtin_clzll(value);
|
return static_cast<u32>(__builtin_clzll(value));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ inline u32 CountTrailingZeroes32(u32 value) {
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u64 CountTrailingZeroes64(u64 value) {
|
inline u32 CountTrailingZeroes64(u64 value) {
|
||||||
unsigned long trailing_zero = 0;
|
unsigned long trailing_zero = 0;
|
||||||
|
|
||||||
if (_BitScanForward64(&trailing_zero, value) != 0) {
|
if (_BitScanForward64(&trailing_zero, value) != 0) {
|
||||||
|
@ -85,15 +85,15 @@ inline u32 CountTrailingZeroes32(u32 value) {
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
return __builtin_ctz(value);
|
return static_cast<u32>(__builtin_ctz(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u64 CountTrailingZeroes64(u64 value) {
|
inline u32 CountTrailingZeroes64(u64 value) {
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
return __builtin_ctzll(value);
|
return static_cast<u32>(__builtin_ctzll(value));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
u64 prios = mlq.used_priorities;
|
u64 prios = mlq.used_priorities;
|
||||||
prios &= ~((1ULL << (current_priority + 1)) - 1);
|
prios &= ~((1ULL << (current_priority + 1)) - 1);
|
||||||
if (prios == 0) {
|
if (prios == 0) {
|
||||||
current_priority = mlq.depth();
|
current_priority = static_cast<u32>(mlq.depth());
|
||||||
} else {
|
} else {
|
||||||
current_priority = CountTrailingZeroes64(prios);
|
current_priority = CountTrailingZeroes64(prios);
|
||||||
it = GetBeginItForPrio();
|
it = GetBeginItForPrio();
|
||||||
|
|
Loading…
Reference in a new issue