[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH] target/ppc: Fix 64-bit decrementer
From: |
Luis Fernando Fujita Pires |
Subject: |
RE: [PATCH] target/ppc: Fix 64-bit decrementer |
Date: |
Mon, 13 Sep 2021 17:22:16 +0000 |
> > bool negative;
> >
> > /* Truncate value to decr_width and sign extend for simplicity */
> > - value &= ((1ULL << nr_bits) - 1);
> > + value &= MAKE_64BIT_MASK(0, nr_bits);
>
> What about:
>
> value = extract64(value, 0, nr_bits);
> if (value != sextract64(value, 0, nr_bits)) { ...
Or:
value = extract64(value, 0, nr_bits);
value = ((target_long)value << (64 - nr_bits)) >> (64 - nr_bits);
Also avoiding the problem with an invalid 64-bit shift with:
> > value |= (0xFFFFFFFFULL << nr_bits);
--
Luis Pires
Instituto de Pesquisas ELDORADO
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>