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

Function get_rev_poly

dpdk/lib/hash/rte_thash.c:163–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163static inline uint32_t
164get_rev_poly(uint32_t poly, int degree)
165{
166 int i;
167 /*
168 * The implicit highest coefficient of the polynomial
169 * becomes the lowest after reversal.
170 */
171 uint32_t rev_poly = 1;
172 uint32_t mask = (1 << degree) - 1;
173
174 /*
175 * Here we assume "poly" argument is an irreducible polynomial,
176 * thus the lowest coefficient of the "poly" must always be equal to "1".
177 * After the reversal, this the lowest coefficient becomes the highest and
178 * it is omitted since the highest coefficient is implicitly determined by
179 * degree of the polynomial.
180 */
181 for (i = 1; i < degree; i++)
182 rev_poly |= ((poly >> i) & 0x1) << (degree - i);
183
184 return rev_poly & mask;
185}
186
187static struct thash_lfsr *
188alloc_lfsr(struct rte_thash_ctx *ctx)

Callers 1

alloc_lfsrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected