Lines Matching +full:least +full:-

1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2019 Intel Corporation
11 * Generic, commonly-used macro and inline function definitions
107 * Check format string and its arguments at compile-time.
109 * GCC on Windows assumes MS-specific format string by default,
110 * even if the underlying stdio implementation is ANSI-compliant,
207 * add a byte-value offset to a pointer
212 * subtract a byte-value offset from a pointer
214 #define RTE_PTR_SUB(ptr, x) ((void*)((uintptr_t)ptr - (x)))
221 #define RTE_PTR_DIFF(ptr1, ptr2) ((uintptr_t)(ptr1) - (uintptr_t)(ptr2))
224 * Workaround to cast a const field of a structure to non-const type.
233 * Macro to align a pointer to a given power-of-two. The resultant
236 * must be a power-of-two value.
242 * Macro to align a value to a given power-of-two. The resultant value
245 * power-of-two value.
248 (typeof(val))((val) & (~((typeof(val))((align) - 1))))
251 * Macro to align a pointer to a given power-of-two. The resultant
254 * must be a power-of-two value.
257 RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)
260 * Macro to align a value to a given power-of-two. The resultant value
262 * than the first parameter. Second parameter must be a power-of-two
266 RTE_ALIGN_FLOOR(((val) + ((typeof(val)) (align) - 1)), align)
269 * Macro to align a pointer to a given power-of-two. The resultant
272 * must be a power-of-two value.
278 * Macro to align a value to a given power-of-two. The resultant
281 * must be a power-of-two value.
292 (((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul))
311 (ceil - v) > (v - floor) ? floor : ceil; \
315 * Checks if a pointer is aligned to a given power-of-two value
320 * The power-of-two value to which the ptr should be aligned
336 #define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
341 #define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)
343 /** Return the first cache-aligned value greater or equal to size. */
345 (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \
370 #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
380 #define RTE_BAD_IOVA ((rte_iova_t)-1)
396 * Combines 32b inputs most significant set bits into the least
418 * Combines 64b inputs most significant set bits into the least
445 #define RTE_IS_POWER_OF_2(n) ((n) && !(((n) - 1) & (n)))
456 return n && !(n & (n - 1)); in rte_is_power_of_2()
471 x--; in rte_align32pow2()
491 return x - (x >> 1); in rte_align32prevpow2()
506 v--; in rte_align64pow2()
526 return v - (v >> 1); in rte_align64prevpow2()
554 * Searches the input parameter for the least significant set bit
556 * If a least significant 1 bit is found, its bit index is returned.
562 * least significant set bit in the input parameter.
571 * Searches the input parameter for the least significant set bit
579 * If ``v`` was not 0, this value will contain position of least significant
595 * Return the rounded-up log2 of a integer.
598 * rte_log2_u32(0) == 0 and not -inf.
603 * The rounded-up log2 of the input, or 0 if the input is 0.
616 * Return the last (most-significant) bit set.
624 * The last (most-significant) bit set, or 0 if the input is 0.
629 return (x == 0) ? 0 : 32 - __builtin_clz(x); in rte_fls_u32()
633 * Searches the input parameter for the least significant set bit
635 * If a least significant 1 bit is found, its bit index is returned.
641 * least significant set bit in the input parameter.
650 * Searches the input parameter for the least significant set bit
658 * If ``v`` was not 0, this value will contain position of least significant
674 * Return the last (most-significant) bit set.
683 * The last (most-significant) bit set, or 0 if the input is 0.
688 return (x == 0) ? 0 : 64 - __builtin_clzll(x); in rte_fls_u64()
692 * Return the rounded-up log2 of a 64-bit integer.
695 * rte_log2_u64(0) == 0 and not -inf.
700 * The rounded-up log2 of the input, or 0 if the input is 0.
733 const typeof(((type *)0)->member) *_ptr = (ptr); \
736 (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \
750 #define RTE_SIZEOF_FIELD(type, field) (sizeof(((type *)0)->field))
767 ((tp)((uint64_t)-1 >> (sizeof(uint64_t) * CHAR_BIT - (ln))))
777 * If a negative number is passed in i.e. a string with the first non-black
778 * character being "-", zero is returned. Zero is also returned in the case of
795 if (*str == '-')
807 case 'G': case 'g': size *= 1024; /* fall-through */
808 case 'M': case 'm': size *= 1024; /* fall-through */
809 case 'K': case 'k': size *= 1024; /* fall-through */