bitops: fix rol/ror when shift is zero
commitecce0369b864e3c505b89942cd8cc23a62a4386f
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Sun, 30 Oct 2016 03:14:55 +0000 (30 08:44 +0530)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 14 Nov 2016 23:05:50 +0000 (15 10:05 +1100)
tree6411d565cfb6ee0644412b94513e1b923c514dda
parent682df581c65ed2c1b9e77093e332214ecaa1ee93
bitops: fix rol/ror when shift is zero

All the variants for rol/ror have a bug in case where the shift == 0.
For example rol32, would generate:

    return (word << 0) | (word >> 32);

Which though works, would be flagged as a runtime error on clang's
sanitizer.

Suggested-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
include/qemu/bitops.h