mirror of
https://github.com/azahar-emu/dynarmic
synced 2025-11-07 07:29:59 +01:00
bit_util: Protect Replicate from automatic up-casting
Recursive calls to `Replicate` beyond the first call might cause an unintentional up-casting to an `int` type due to `|` and `<<` operations on types such as `uint8_t` and `uint16_t` This makes sure calls such as `Recursive<u8>` stay as the `u8` type through-out.
This commit is contained in:
parent
f171ce7859
commit
46b8cfabc0
@ -203,7 +203,7 @@ constexpr T Replicate(T value, size_t element_size) {
|
|||||||
ASSERT_MSG(BitSize<T>() % element_size == 0, "bitsize of T not divisible by element_size");
|
ASSERT_MSG(BitSize<T>() % element_size == 0, "bitsize of T not divisible by element_size");
|
||||||
if (element_size == BitSize<T>())
|
if (element_size == BitSize<T>())
|
||||||
return value;
|
return value;
|
||||||
return Replicate(value | (value << element_size), element_size * 2);
|
return Replicate<T>(T(value | value << element_size), element_size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user