bitops.h: Implement half-shuffle and half-unshuffle ops
commitb355438de52d0782983bf4bdc47936189a0c988b
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 17 Jun 2016 14:23:45 +0000 (17 15:23 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 17 Jun 2016 14:23:51 +0000 (17 15:23 +0100)
tree2a93d70d0440c5506d1b231af1d930672d4d11a9
parent04716bc8fd919a0ac1c8c4502250b01eda39dd4a
bitops.h: Implement half-shuffle and half-unshuffle ops

A half-shuffle operation takes a word with zeros in the high half:
 0000 0000 0000 0000 ABCD EFGH IJKL MNOP
and spreads the bits out so they are in every other bit of the word:
 0A0B 0C0D 0E0F 0G0H 0I0J 0K0L 0M0N 0O0P
A half-unshuffle performs the reverse operation.

Provide functions in bitops.h which implement these operations
for 32-bit and 64-bit inputs, and add tests for them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
Tested-by: Shannon Zhao <shannon.zhao@linaro.org>
Message-id: 1465915112-29272-3-git-send-email-peter.maydell@linaro.org
include/qemu/bitops.h
tests/test-bitops.c