bitops.h: Add functions to extract and deposit bitfields
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 6 Jul 2012 14:48:00 +0000 (15:48 +0100)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 7 Jul 2012 09:07:01 +0000 (09:07 +0000)
commit84988cf910a6881f2180fdcec516b60f8f0dc8c4
tree8c7267aa5e548bdf657ce080e912ec05a69b8a94
parentbedc2ac1a746e61e2a42c98603922c488b82cddb
bitops.h: Add functions to extract and deposit bitfields

Add functions deposit32(), deposit64(), extract32() and extract64()
to extract and deposit bitfields in 32 and 64 bit words. Based on
ideas by Jia Liu and Avi Kivity.

Suggested-by: Jia Liu <proljc@gmail.com>
Suggested-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
bitops.h