MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_popcount64

Function test_popcount64

dpdk/app/test/test_bitcount.c:95–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95static int
96test_popcount64(void)
97{
98 size_t shift;
99 uint64_t v = 0;
100 const size_t bits = sizeof(v) * CHAR_BIT;
101
102 for (shift = 0; shift < bits; shift++) {
103 RTE_TEST_ASSERT(rte_popcount64(v) == shift,
104 "Unexpected count.");
105 v <<= 1;
106 v |= 1;
107 }
108
109 RTE_TEST_ASSERT(rte_popcount64(v) == bits,
110 "Unexpected count.");
111
112 return 0;
113}
114
115static struct unit_test_suite bitcount_test_suite = {
116 .suite_name = "bitcount autotest",

Callers

nothing calls this directly

Calls 1

rte_popcount64Function · 0.85

Tested by

no test coverage detected