| 93 | } |
| 94 | |
| 95 | static int |
| 96 | test_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 | |
| 115 | static struct unit_test_suite bitcount_test_suite = { |
| 116 | .suite_name = "bitcount autotest", |
nothing calls this directly
no test coverage detected