Module: xenomai-3
Branch: stable-3.0.x
Commit: 5ec8be8b0588715baf92f8ababede5a1189e4f18
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5ec8be8b0588715baf92f8ababede5a1189e4f18

Author: Antoine Hoarau <hoarau.robot...@gmail.com>
Date:   Thu Sep 28 16:19:09 2017 +0200

boilerplate: rename clz()/ctz() -> __clz()/__ctz()

Prevents conflicts with libtbb that defines clz as an inline function and gets
replaced by those macros. Temporary fix waiting to move this code in private 
headers.

---

 include/boilerplate/compiler.h    |    4 ++--
 lib/copperplate/heapobj-pshared.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index 0509e33..bcef7d4 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -64,7 +64,7 @@ extern "C" {
        
 void __invalid_operand_size(void);
 
-#define ctz(__v)                                                       \
+#define __ctz(__v)                                                     \
        ({                                                              \
                int __ret;                                              \
                if (!__v)                                               \
@@ -83,7 +83,7 @@ void __invalid_operand_size(void);
                __ret;                                                  \
        })
 
-#define clz(__v)                                                       \
+#define __clz(__v)                                                     \
        ({                                                              \
                int __ret;                                              \
                if (!__v)                                               \
diff --git a/lib/copperplate/heapobj-pshared.c 
b/lib/copperplate/heapobj-pshared.c
index 578f442..03d6eaa 100644
--- a/lib/copperplate/heapobj-pshared.c
+++ b/lib/copperplate/heapobj-pshared.c
@@ -291,7 +291,7 @@ static int reserve_page_range(uint32_t *bitmap, int 
bitwords, int nrpages)
                v = bitmap[n];
                b = 0;
                while (v != -1U) {
-                       r = ctz(v);
+                       r = __ctz(v);
                        if (r) {
                                seq += r;
                                if (seq >= nrpages) {
@@ -432,7 +432,7 @@ static void *alloc_block(struct shared_heap *heap, size_t 
size)
         */
        if (size <= HOBJ_PAGE_SIZE * 2) {
                /* Find log2(size). */
-               log2size = sizeof(size) * 8 - 1 - clz(size);
+               log2size = sizeof(size) * 8 - 1 - __clz(size);
                if (size & (size - 1))
                        log2size++;
                /* That is the actual block size we need. */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to