Re: [Qemu-devel] [RFC] bitops: Provide sext32() and sext64() for signextending bitfields

2013-06-27 Thread Peter Maydell
On 27 June 2013 18:58, Markus Armbruster wrote: > Peter Maydell writes: >> Does the API look right? The other approach I thought of would >> be to have functions sextract32()/sextract64() which work like >> the existing extract{32,64} but return signed (and sign >> extended) values, but providing

Re: [Qemu-devel] [RFC] bitops: Provide sext32() and sext64() for signextending bitfields

2013-06-27 Thread Markus Armbruster
Peter Maydell writes: > A common operation in instruction decoding is to take a field > from an instruction that represents a signed integer in some > arbitrary number of bits, and sign extend it into a C signed > integer type for manipulation. Provide new functions sext32() > and sext64() to abs

Re: [Qemu-devel] [RFC] bitops: Provide sext32() and sext64() for signextending bitfields

2013-06-27 Thread Richard Henderson
On 06/27/2013 08:47 AM, Peter Maydell wrote: > A common operation in instruction decoding is to take a field > from an instruction that represents a signed integer in some > arbitrary number of bits, and sign extend it into a C signed > integer type for manipulation. Provide new functions sext32()

[Qemu-devel] [RFC] bitops: Provide sext32() and sext64() for signextending bitfields

2013-06-27 Thread Peter Maydell
A common operation in instruction decoding is to take a field from an instruction that represents a signed integer in some arbitrary number of bits, and sign extend it into a C signed integer type for manipulation. Provide new functions sext32() and sext64() to abstract away the bit manipulation.