Synchronize RTEMS <sys/bitset.h> with FreeBSD

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber 2017-07-07 07:07:19 +02:00
parent bf61b38d98
commit 1d49ce4d6b
1 changed files with 16 additions and 1 deletions

View File

@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: head/sys/sys/bitset.h 318781 2017-05-24 10:09:54Z kib $ * $FreeBSD: head/sys/sys/bitset.h 320755 2017-07-06 21:47:17Z kib $
*/ */
#ifndef _SYS_BITSET_H_ #ifndef _SYS_BITSET_H_
@ -216,6 +216,21 @@
__bit; \ __bit; \
}) })
#define BIT_FLS(_s, p) __extension__ ({ \
__size_t __i; \
int __bit; \
\
__bit = 0; \
for (__i = __bitset_words((_s)) - 1; __i >= 0; __i--) { \
if ((p)->__bits[__i] != 0) { \
__bit = flsl((p)->__bits[__i]); \
__bit += __i * _BITSET_BITS; \
break; \
} \
} \
__bit; \
})
#define BIT_COUNT(_s, p) __extension__ ({ \ #define BIT_COUNT(_s, p) __extension__ ({ \
__size_t __i; \ __size_t __i; \
int __count; \ int __count; \