mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Remove conditional, make generic enough for both 32- and 64-bit operation.
This commit is contained in:
parent
a5ed288db2
commit
bb5cf570e5
@ -1451,12 +1451,13 @@ struct Instruction {
|
|||||||
/// mb < me+1 => set [mb, me]
|
/// mb < me+1 => set [mb, me]
|
||||||
/// mb == me+1 => set all bits
|
/// mb == me+1 => set all bits
|
||||||
/// mb > me+1 => complement of set [me+1, mb-1]
|
/// mb > me+1 => complement of set [me+1, mb-1]
|
||||||
uint32_t rotate_mask() const {
|
template <typename IntT> IntT rotate_mask() const {
|
||||||
const auto mb_bit = mb();
|
const auto mb_bit = mb();
|
||||||
const auto me_bit = me();
|
const auto me_bit = me();
|
||||||
|
|
||||||
uint32_t result = (0xffff'ffff >> mb_bit) ^ (0x7fff'ffff >> me_bit);
|
const IntT result = (0xffff'ffff >> mb_bit) ^ (0x7fff'ffff >> me_bit);
|
||||||
return result ^ ((mb_bit < me_bit+1) ? 0 : 0xffff'ffff);
|
const IntT sign = ~IntT((int32_t(mb_bit) - int32_t(me_bit+1)) >> 16);
|
||||||
|
return result ^ sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Condition register source bit A.
|
/// Condition register source bit A.
|
||||||
|
Loading…
Reference in New Issue
Block a user