Rename __clz to xenomai_count_leading_zeros
PATCH 1/1 Rename __clz to xenomai_count_leading_zeros
Quoted 1 line
From
398a77d3d172c10cda9826a7cc2a15266ff4c6a9Mon Sep 17 00:00:00 2001
From: Giulio Moro <[email protected]>
Date: Sat, 10 Nov 2018 20:23:10 +0000
Subject: [PATCH] Rename __clz to xenomai_count_leading_zeros.
This is to avoid namespace conflicts (e.g.: with Clang's arm_acle.h)
--- include/boilerplate/compiler.h | 2 +- lib/boilerplate/heapmem.c | 3 ++- lib/copperplate/heapobj-heapmem.c | 3 ++- lib/copperplate/heapobj-pshared.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-)
include/boilerplate/compiler.h +1 -1
@@ -93,7 +93,7 @@ void __invalid_operand_size(void); __ret; \ }) -#define __clz (__v) \ +#define xenomai_count_leading_zeros (__v) \ ({ \ int __ret; \ if (!__v) \
lib/boilerplate/heapmem.c +2 -1
@@ -435,7 +435,8 @@ void *heapmem_alloc(struct heap_memory *heap, size_t size) bsize = size =HEAPMEM_MIN_ALIGN ; log2size =HEAPMEM_MIN_LOG2 ; }else { - log2size =sizeof (size) *CHAR_BIT -1 -__clz (size); + log2size =sizeof (size) *CHAR_BIT -1 - +xenomai_count_leading_zeros (size);if (log2size <HEAPMEM_PAGE_SHIFT ) {if (size & (size -1 )) log2size++;
lib/copperplate/heapobj-heapmem.c +2 -1
@@ -68,7 +68,8 @@ int __heapobj_init_private(struct heapobj *hobj, const char *name,int heapobj_init_array_private (struct heapobj *hobj,const char *name,size_t size,int elems) { -size_t log2 =sizeof (size) *CHAR_BIT -1 -__clz (size); +size_t log2 =sizeof (size) *CHAR_BIT -1 - +xenomai_count_leading_zeros (size);/* * Heapmem aligns individual object sizes on the next ^2
lib/copperplate/heapobj-pshared.c +2 -1
@@ -488,7 +488,8 @@ static void *sheapmem_alloc(struct shared_heap_memory *heap, size_t size) bsize = size =SHEAPMEM_MIN_ALIGN ; log2size =SHEAPMEM_MIN_LOG2 ; }else { - log2size =sizeof (size) *CHAR_BIT -1 -__clz (size); + log2size =sizeof (size) *CHAR_BIT -1 - +xenomai_count_leading_zeros (size);if (log2size <SHEAPMEM_PAGE_SHIFT ) {if (size & (size -1 )) log2size++;
--
2.11.0
Jan Kiszka
AppliedQuoted 71 lines · Giulio Moro via Xenomai
From
398a77d3d172c10cda9826a7cc2a15266ff4c6a9Mon Sep 17 00:00:00 2001
From: Giulio Moro <[email protected]>
Date: Sat, 10 Nov 2018 20:23:10 +0000
Subject: [PATCH] Rename__clztoxenomai_count_leading_zeros.This is to avoid namespace conflicts (e.g.: with Clang's
arm_acle.h)Signed-off-by Giulio Moro <[email protected]>--- include/boilerplate/compiler.h | 2 +- lib/boilerplate/heapmem.c | 3 ++- lib/copperplate/heapobj-heapmem.c | 3 ++- lib/copperplate/heapobj-pshared.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-)include/boilerplate/compiler.h +1
-1@@ -93,7 +93,7 @@ void __invalid_operand_size(void); __ret; \ }) -#define __clz (__v) \ +#define xenomai_count_leading_zeros (__v) \ ({ \ int __ret; \ if (!__v) \lib/boilerplate/heapmem.c +2
-1@@ -435,7 +435,8 @@ void *heapmem_alloc(struct heap_memory *heap, size_t size) bsize = size =HEAPMEM_MIN_ALIGN ; log2size =HEAPMEM_MIN_LOG2 ; }else { - log2size =sizeof (size) *CHAR_BIT -1 -__clz (size); + log2size =sizeof (size) *CHAR_BIT -1 - +xenomai_count_leading_zeros (size);if (log2size <HEAPMEM_PAGE_SHIFT ) {if (size & (size -1 )) log2size++;lib/copperplate/heapobj-heapmem.c +2
-1@@ -68,7 +68,8 @@ int __heapobj_init_private(struct heapobj *hobj, const char *name,int heapobj_init_array_private (struct heapobj *hobj,const char *name,size_t size,int elems) { -size_t log2 =sizeof (size) *CHAR_BIT -1 -__clz (size); +size_t log2 =sizeof (size) *CHAR_BIT -1 - +xenomai_count_leading_zeros (size);/* * Heapmem aligns individual object sizes on the next ^2 lib/copperplate/heapobj-pshared.c +2
-2@@ -488,7 +488,8 @@ static void *sheapmem_alloc(struct shared_heap_memory *heap, size_t size) bsize = size =SHEAPMEM_MIN_ALIGN ; log2size =SHEAPMEM_MIN_LOG2 ; }else { - log2size =sizeof (size) *CHAR_BIT -1 -__clz (size); + log2size =sizeof (size) *CHAR_BIT -1 - +xenomai_count_leading_zeros (size);if (log2size <SHEAPMEM_PAGE_SHIFT ) {if (size & (size -1 )) log2size++; --
Quoted 3 lines
2.11.0
Thanks, applied to next.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
PATCH 1/1 Rename __clz to xenomai_count_leading_zeros
From: Giulio Moro <[email protected]>
This is to avoid namespace conflicts (e.g.: with Clang's arm_acle.h)
--- include/boilerplate/compiler.h | 2 +- lib/copperplate/heapobj-pshared.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
include/boilerplate/compiler.h +1 -1
@@ -83,7 +83,7 @@ void __invalid_operand_size(void); __ret; \ }) -#define __clz (__v) \ +#define xenomai_count_leading_zeros (__v) \ ({ \ int __ret; \ if (!__v) \
lib/copperplate/heapobj-pshared.c +2 -1
@@ -439,7 +439,8 @@ 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 - +xenomai_count_leading_zeros (size);if (size & (size -1 )) log2size++;/* That is the actual block size we need. */
Signature · 1 line
2.16.4