public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: newlib@sourceware.org
Subject: [PATCH] Synchronize RTEMS <sys/bitset.h> with FreeBSD
Date: Fri, 07 Jul 2017 05:12:00 -0000	[thread overview]
Message-ID: <20170707051210.15337-1-sebastian.huber@embedded-brains.de> (raw)

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/sys/rtems/include/sys/bitset.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/rtems/include/sys/bitset.h
index ec75223e9..4c58f1fb7 100644
--- a/newlib/libc/sys/rtems/include/sys/bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/bitset.h
@@ -26,7 +26,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * 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_
@@ -216,6 +216,21 @@
 	__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__ ({				\
 	__size_t __i;							\
 	int __count;							\
-- 
2.12.3

             reply	other threads:[~2017-07-07  5:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07  5:12 Sebastian Huber [this message]
2017-07-07 14:45 ` Corinna Vinschen
2017-07-12  8:36 Sebastian Huber
2017-07-12  9:27 ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170707051210.15337-1-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).