Skip to contentSkip to conversation

bitops.h: sextract64() return type should be int64_t, not uint64_t

PATCH In review Peter Maydell 2 participants 3 messages Feb 6, 2015 – Mar 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitops.h: sextract64() return type should be int64_t, not uint64_t

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.

---
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(-)
include/qemu/bitops.h +1 -1
index 181bd46..90ca8df 100644
@@ -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
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Peter Maydell

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.

---
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 +-

Via trivial?

r~

#2 lore raw
Quoted 13 lines · Richard Henderson
Quoted 11 lines · Peter Maydell

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.

---
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 +-
Quoted 3 lines

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