for (i = 1; i <= MAX_NUM; i++) {
/* align floor */
- if (rte_align_floor_int((uintptr_t)i, p) % p)
- FAIL_ALIGN("rte_align_floor_int", i, p);
+ if (RTE_ALIGN_FLOOR((uintptr_t)i, p) % p)
+ FAIL_ALIGN("RTE_ALIGN_FLOOR", i, p);
val = RTE_PTR_ALIGN_FLOOR((uintptr_t) i, p);
if (ERROR_FLOOR(val, i, p))
/*********** Macros/static functions for doing alignment ********/
-/**
- * Function which rounds an unsigned int down to a given power-of-two value.
- * Takes uintptr_t types as parameters, as this type of operation is most
- * commonly done for pointer alignment. (See also RTE_ALIGN_FLOOR,
- * RTE_ALIGN_CEIL, RTE_ALIGN, RTE_PTR_ALIGN_FLOOR, RTE_PTR_ALIGN_CEL,
- * RTE_PTR_ALIGN macros)
- * @param ptr
- * The value to be rounded down
- * @param align
- * The power-of-two of which the result must be a multiple.
- * @return
- * Function returns a properly aligned value where align is a power-of-two.
- * If align is not a power-of-two, result will be incorrect.
- */
-static inline uintptr_t
-rte_align_floor_int(uintptr_t ptr, uintptr_t align)
-{
- return (ptr & ~(align - 1));
-}
/**
* Macro to align a pointer to a given power-of-two. The resultant
* must be a power-of-two value.
*/
#define RTE_PTR_ALIGN_FLOOR(ptr, align) \
- (typeof(ptr))rte_align_floor_int((uintptr_t)ptr, align)
+ ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align))
/**
* Macro to align a value to a given power-of-two. The resultant value
{
const uintptr_t end_pt = (uintptr_t)elem +
elem->size - MALLOC_ELEM_TRAILER_LEN;
- const uintptr_t new_data_start = rte_align_floor_int((end_pt - size),align);
+ const uintptr_t new_data_start = RTE_ALIGN_FLOOR((end_pt - size), align);
const uintptr_t new_elem_start = new_data_start - MALLOC_ELEM_HEADER_LEN;
/* if the new start point is before the exist start, it won't fit */