From: Bruce Richardson Date: Wed, 12 Feb 2014 16:26:03 +0000 (+0000) Subject: sched: use common macro RTE_DIM X-Git-Tag: spdx-start~11038 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=657eabecd878194c362b30c53bdeddfbe0dcd5ef;p=dpdk.git sched: use common macro RTE_DIM Replace local DIM() macro with RTE_DIM in rte_red.c Signed-off-by: Bruce Richardson --- diff --git a/lib/librte_sched/rte_red.c b/lib/librte_sched/rte_red.c index fbec27c361..f63e195fbf 100644 --- a/lib/librte_sched/rte_red.c +++ b/lib/librte_sched/rte_red.c @@ -34,13 +34,12 @@ #include #include "rte_red.h" #include +#include #ifdef __INTEL_COMPILER #pragma warning(disable:2259) /* conversion may lose significant bits */ #endif -#define DIM(x) (sizeof(x)/sizeof(x[0])) - static int rte_red_init_done = 0; /**< Flag to indicate that global initialisation is done */ uint32_t rte_red_rand_val = 0; /**< Random value cache */ uint32_t rte_red_rand_seed = 0; /**< Seed for random number generation */ @@ -68,9 +67,9 @@ __rte_red_init_tables(void) double table_size = 0.0; scale = (double)(1 << RTE_RED_SCALING); - table_size = (double)(DIM(rte_red_pow2_frac_inv)); + table_size = (double)(RTE_DIM(rte_red_pow2_frac_inv)); - for (i = 0; i < DIM(rte_red_pow2_frac_inv); i++) { + for (i = 0; i < RTE_DIM(rte_red_pow2_frac_inv); i++) { double m = (double)i; rte_red_pow2_frac_inv[i] = (uint16_t) round(scale / pow(2, m / table_size)); @@ -78,7 +77,7 @@ __rte_red_init_tables(void) scale = 1024.0; - RTE_RED_ASSERT(RTE_RED_WQ_LOG2_NUM == DIM(rte_red_log2_1_minus_Wq)); + RTE_RED_ASSERT(RTE_RED_WQ_LOG2_NUM == RTE_DIM(rte_red_log2_1_minus_Wq)); for (i = RTE_RED_WQ_LOG2_MIN; i <= RTE_RED_WQ_LOG2_MAX; i++) { double n = (double)i;