mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Fix is_zero_mask.
This commit is contained in:
parent
31276de5c3
commit
59a1fde2a1
@ -59,9 +59,9 @@ enum class BranchOption: uint32_t {
|
|||||||
|
|
||||||
/// @returns @c 0 if reg == 0; @c ~0 otherwise.
|
/// @returns @c 0 if reg == 0; @c ~0 otherwise.
|
||||||
/// @discussion Provides a branchless way to substitute the value 0 for the value of r0
|
/// @discussion Provides a branchless way to substitute the value 0 for the value of r0
|
||||||
/// in affected instructions.
|
/// in affected instructions. Assumes arithmetic shifts.
|
||||||
template <typename IntT> constexpr IntT is_zero_mask(uint32_t reg) {
|
template <typename IntT> constexpr IntT is_zero_mask(uint32_t reg) {
|
||||||
return ~IntT((reg - 1) >> 5);
|
return ~IntT((int(reg) - 1) >> 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Operation: uint8_t {
|
enum class Operation: uint8_t {
|
||||||
|
Loading…
Reference in New Issue
Block a user