summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPavan Nikhilesh <pbhagavatula@marvell.com>2019-03-16 19:01:50 +0000
committerThomas Monjalon <thomas@monjalon.net>2019-03-28 00:45:00 +0100
commitf56e551485d5461e5dab76b2c47164bbf646a445 (patch)
treeaa02b78f2557f5c094df0c55ba98ea6bd67bbf9f /app
parent55878866eb2b6d4e00ff5624259a92f13e10b481 (diff)
downloaddpdk-next-eventdev-f56e551485d5461e5dab76b2c47164bbf646a445.zip
dpdk-next-eventdev-f56e551485d5461e5dab76b2c47164bbf646a445.tar.gz
dpdk-next-eventdev-f56e551485d5461e5dab76b2c47164bbf646a445.tar.xz
eal: add macro to align value to the nearest multiple
Add macro to align value to the nearest multiple of the given value, resultant value might be greater than or less than the first parameter whichever difference is the lowest. Update unit test to include the new macro. Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Diffstat (limited to 'app')
-rw-r--r--app/test/test_common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/test/test_common.c b/app/test/test_common.c
index 94d3674..2b856f8 100644
--- a/app/test/test_common.c
+++ b/app/test/test_common.c
@@ -199,6 +199,10 @@ test_align(void)
val = RTE_ALIGN_MUL_FLOOR(i, p);
if (val % p != 0 || val > i)
FAIL_ALIGN("RTE_ALIGN_MUL_FLOOR", i, p);
+ val = RTE_ALIGN_MUL_NEAR(i, p);
+ if (val % p != 0 || ((val != RTE_ALIGN_MUL_CEIL(i, p))
+ & (val != RTE_ALIGN_MUL_FLOOR(i, p))))
+ FAIL_ALIGN("RTE_ALIGN_MUL_NEAR", i, p);
}
}