From f7a9461e29147c47ce2bb81bd157ac1833cf5eb1 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 20 Mar 2019 14:45:09 +0000 Subject: New upstream version 16.11.9 Change-Id: Ia1ac246c53e5050b6a29d6952fb668ad6c782996 Signed-off-by: Luca Boccassi --- app/test/test_common.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'app/test/test_common.c') diff --git a/app/test/test_common.c b/app/test/test_common.c index 8effa2f9..afd2b99f 100644 --- a/app/test/test_common.c +++ b/app/test/test_common.c @@ -158,6 +158,37 @@ test_align(void) return 0; } +static int +test_fls(void) +{ + struct fls_test_vector { + uint32_t arg; + int rc; + }; + int expected, rc; + uint32_t i, arg; + + const struct fls_test_vector test[] = { + {0x0, 0}, + {0x1, 1}, + {0x4000, 15}, + {0x80000000, 32}, + }; + + for (i = 0; i < RTE_DIM(test); i++) { + arg = test[i].arg; + rc = rte_fls_u32(arg); + expected = test[i].rc; + if (rc != expected) { + printf("Wrong rte_fls_u32(0x%x) rc=%d, expected=%d\n", + arg, rc, expected); + return TEST_FAILED; + } + } + + return 0; +} + static int test_common(void) { @@ -165,6 +196,7 @@ test_common(void) ret |= test_align(); ret |= test_macros(0); ret |= test_misc(); + ret |= test_fls(); return ret; } -- cgit 1.2.3-korg