Commit 9f6e9ba5 authored by Giulio Moro's avatar Giulio Moro Committed by Jan Kiszka

Rename __clz to xenomai_count_leading_zeros

This is to avoid namespace conflicts (e.g.: with Clang's arm_acle.h)
Signed-off-by: 's avatarGiulio Moro <giuliomoro@yahoo.it>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 04d874ce
......@@ -93,7 +93,7 @@ void __invalid_operand_size(void);
__ret; \
})
#define __clz(__v) \
#define xenomai_count_leading_zeros(__v) \
({ \
int __ret; \
if (!__v) \
......
......@@ -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++;
......
......@@ -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
......
......@@ -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++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment