mirror of https://github.com/xemu-project/xemu.git
target/arm: Replace bitmask64 with MAKE_64BIT_MASK
Use the bitops.h macro rather than rolling our own here. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20230512144106.3608981-9-peter.maydell@linaro.org
This commit is contained in:
parent
86002eccb9
commit
000bcd008f
|
@ -4288,13 +4288,6 @@ static uint64_t bitfield_replicate(uint64_t mask, unsigned int e)
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a value with the bottom len bits set (where 0 < len <= 64) */
|
|
||||||
static inline uint64_t bitmask64(unsigned int length)
|
|
||||||
{
|
|
||||||
assert(length > 0 && length <= 64);
|
|
||||||
return ~0ULL >> (64 - length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Simplified variant of pseudocode DecodeBitMasks() for the case where we
|
/* Simplified variant of pseudocode DecodeBitMasks() for the case where we
|
||||||
* only require the wmask. Returns false if the imms/immr/immn are a reserved
|
* only require the wmask. Returns false if the imms/immr/immn are a reserved
|
||||||
* value (ie should cause a guest UNDEF exception), and true if they are
|
* value (ie should cause a guest UNDEF exception), and true if they are
|
||||||
|
@ -4350,10 +4343,10 @@ bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn,
|
||||||
/* Create the value of one element: s+1 set bits rotated
|
/* Create the value of one element: s+1 set bits rotated
|
||||||
* by r within the element (which is e bits wide)...
|
* by r within the element (which is e bits wide)...
|
||||||
*/
|
*/
|
||||||
mask = bitmask64(s + 1);
|
mask = MAKE_64BIT_MASK(0, s + 1);
|
||||||
if (r) {
|
if (r) {
|
||||||
mask = (mask >> r) | (mask << (e - r));
|
mask = (mask >> r) | (mask << (e - r));
|
||||||
mask &= bitmask64(e);
|
mask &= MAKE_64BIT_MASK(0, e);
|
||||||
}
|
}
|
||||||
/* ...then replicate the element over the whole 64 bit value */
|
/* ...then replicate the element over the whole 64 bit value */
|
||||||
mask = bitfield_replicate(mask, e);
|
mask = bitfield_replicate(mask, e);
|
||||||
|
|
Loading…
Reference in New Issue