Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP3:Update
xen
libxc-bitmap-long.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libxc-bitmap-long.patch of Package xen
From: Olaf Hering <olaf@aepfle.de> Date: Wed, 9 Dec 2020 16:40:00 +0100 Subject: bitmap long tools: add API to work with sevaral bits at once Introduce new API to test if a fixed number of bits is clear or set, and clear or set them all at once. The caller has to make sure the input bitnumber is a multiply of BITS_PER_LONG. This API avoids the loop over each bit in a known range just to see if all of them are either clear or set. Signed-off-by: Olaf Hering <olaf@aepfle.de> --- tools/libxc/xc_bitops.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) Index: xen-4.14.0-testing/tools/libxc/xc_bitops.h =================================================================== --- xen-4.14.0-testing.orig/tools/libxc/xc_bitops.h +++ xen-4.14.0-testing/tools/libxc/xc_bitops.h @@ -79,4 +79,29 @@ static inline void bitmap_or(void *_dst, dst[i] |= other[i]; } +static inline int test_bit_long_set(unsigned long nr_base, const void *_addr) +{ + const unsigned long *addr = _addr; + unsigned long val = addr[nr_base / BITS_PER_LONG]; + return val == ~0; +} + +static inline int test_bit_long_clear(unsigned long nr_base, const void *_addr) +{ + const unsigned long *addr = _addr; + unsigned long val = addr[nr_base / BITS_PER_LONG]; + return val == 0; +} + +static inline void clear_bit_long(unsigned long nr_base, void *_addr) +{ + unsigned long *addr = _addr; + addr[nr_base / BITS_PER_LONG] = 0; +} + +static inline void set_bit_long(unsigned long nr_base, void *_addr) +{ + unsigned long *addr = _addr; + addr[nr_base / BITS_PER_LONG] = ~0; +} #endif /* XC_BITOPS_H */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor