qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] bitops.h: sextract64() return type should be int64_t, not uint64_t
@ 2015-02-06 14:02 Peter Maydell
  2015-02-13  6:21 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2015-02-06 14:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

The documentation for sextract64() claims that the return type is
an int64_t, but the code itself disagrees. Fix the return type to
conform to the documentation and to bring it into line with
sextract32(), which returns int32_t.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I quickly eyeballed all the callers and I don't think any of them
were relying on the unsignedness of the return type.
---
 include/qemu/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
index 181bd46..90ca8df 100644
--- a/include/qemu/bitops.h
+++ b/include/qemu/bitops.h
@@ -354,7 +354,7 @@ static inline int32_t sextract32(uint32_t value, int start, int length)
  * Returns: the sign extended value of the bit field extracted from the
  * input value.
  */
-static inline uint64_t sextract64(uint64_t value, int start, int length)
+static inline int64_t sextract64(uint64_t value, int start, int length)
 {
     assert(start >= 0 && length > 0 && length <= 64 - start);
     /* Note that this implementation relies on right shift of signed
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] bitops.h: sextract64() return type should be int64_t, not uint64_t
  2015-02-06 14:02 [Qemu-devel] [PATCH] bitops.h: sextract64() return type should be int64_t, not uint64_t Peter Maydell
@ 2015-02-13  6:21 ` Richard Henderson
  2015-03-11 11:32   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2015-02-13  6:21 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches

On 02/06/2015 06:02 AM, Peter Maydell wrote:
> The documentation for sextract64() claims that the return type is
> an int64_t, but the code itself disagrees. Fix the return type to
> conform to the documentation and to bring it into line with
> sextract32(), which returns int32_t.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I quickly eyeballed all the callers and I don't think any of them
> were relying on the unsignedness of the return type.
> ---
>  include/qemu/bitops.h | 2 +-

Reviewed-by: Richard Henderson <rth@twiddle.net>

Via trivial?


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] bitops.h: sextract64() return type should be int64_t, not uint64_t
  2015-02-13  6:21 ` Richard Henderson
@ 2015-03-11 11:32   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2015-03-11 11:32 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Trivial, QEMU Developers, Patch Tracking

On 13 February 2015 at 06:21, Richard Henderson <rth@twiddle.net> wrote:
> On 02/06/2015 06:02 AM, Peter Maydell wrote:
>> The documentation for sextract64() claims that the return type is
>> an int64_t, but the code itself disagrees. Fix the return type to
>> conform to the documentation and to bring it into line with
>> sextract32(), which returns int32_t.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> I quickly eyeballed all the callers and I don't think any of them
>> were relying on the unsignedness of the return type.
>> ---
>>  include/qemu/bitops.h | 2 +-
>
> Reviewed-by: Richard Henderson <rth@twiddle.net>
>
> Via trivial?

I guess I forgot to cc trivial there. I can just put it in the
ARM pullreq I'm doing anyway I suppose...

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-11 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 14:02 [Qemu-devel] [PATCH] bitops.h: sextract64() return type should be int64_t, not uint64_t Peter Maydell
2015-02-13  6:21 ` Richard Henderson
2015-03-11 11:32   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).