Hi,

On Tue, 19 Nov 2013, Claudio Fontana wrote:

> > +    uint64_t imm;
> > +    uint64_t base;
> > +
> > +    imm = get_sbits(insn, 5, 19) << 2;
> > +    imm |= get_bits(insn, 29, 2);
> 
> does this work with negative values?

Yes.  get_sbits returns a sign extended (32bit) int, the shift doesn't 
change that, the conversion to uint64_t first sign extends to 64bit and 
then converts to unsigned (conceptually).  From then on it's an unsigned 
value (with high bits set when input was negative), but two complement 
arithmetic makes that irrelevant.


Ciao,
Michael.

Reply via email to