aboutsummaryrefslogtreecommitdiff
path: root/bitops.h
AgeCommit message (Collapse)AuthorFilesLines
2012-08-04bitops: drop volatile qualifierBlue Swirl1-13/+13
Qualifier 'volatile' is not useful for applications, it's too strict for single threaded code but does not give the real atomicity guarantees needed for multithreaded code. Drop them and now useless casts. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-13bitops: Fix documentationStefan Weil1-4/+4
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-07bitops.h: Add functions to extract and deposit bitfieldsPeter Maydell1-0/+90
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>
2011-02-25bitops: fix error on OpenBSD and mingw32Blue Swirl1-1/+1
Fix this error: CC bitops.o In file included from /src/qemu/bitops.c:14: /src/qemu/bitops.h:69: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned' Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-25bitops: fix test_and_change_bit()Corentin Chary1-1/+1
./bitops.h:192: warning: ‘old’ is used uninitialized in this function Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-23bitmap: add a generic bitmap and bitops libraryCorentin Chary1-0/+272
Add most used bitmap and bitops functions into bitmap.c and bitops.c. Theses functions are mostly copied from Linux kernel source. Some of these functions are already redefined in the VNC server. Some of them could be used for some block stuff. The yet yo be submitted NUMA work also need bitmaps. bitops_ffsl() and bitops_flsl() are here because bitops/bitmap works on unsigned long, not int, and we can't use current code because: * ffs only works on int * qemu_fls only works on int * ffsl is a GNU extension Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>