src/dpdk/lib/librte_mbuf/rte_mbuf_dyn.c
static void
process_score(void)
{
	size_t off, align, size, i;

	/* first, erase previous info */
	for (i = 0; i < sizeof(struct rte_mbuf); i++) {
		if (shm->free_space[i])
			shm->free_space[i] = 1;
	}

	off = 0;
	while (off < sizeof(struct rte_mbuf)) {
		/* get the size of the free zone */
		for (size = 0; (off + size) < sizeof(struct rte_mbuf) &&
			     shm->free_space[off + size]; size++)
			;
		if (size == 0) {
			off++;
			continue;
		}

		/* get the alignment of biggest object that can fit in
		 * the zone at this offset.
		 */
		for (align = 1;
		     (off % (align << 1)) == 0 && (align << 1) <= size;
		     align <<= 1)
			;

		/* save it in free_space[] */
		for (i = off; i < off + align; i++)
			shm->free_space[i] = RTE_MAX(align, shm->free_space[i]);

		off += align;
	}
}
/* Set the value of free_space[] according to the size and alignment of
 * the free areas. This helps to select the best place when reserving a
 * dynamic field. Assume tailq is locked.
 */
Set the value of free_space[] according to the size and alignment of
the free areas. This helps to select the best place when reserving a
dynamic field. Assume tailq is locked.
Set the value of free_space [] according to the size and alignment of the free areas . This helps to select the best place when reserving a dynamic field . Assume tailq is locked .
static void
process_score(void)
{
	size_t off, align, size, i;
	for (i = 0; i < sizeof(struct rte_mbuf); i++) {
		if (shm->free_space[i])
			shm->free_space[i] = 1;
	}
	off = 0;
	while (off < sizeof(struct rte_mbuf)) {
		for (size = 0; (off + size) < sizeof(struct rte_mbuf) &&
			     shm->free_space[off + size]; size++)
			;
		if (size == 0) {
			off++;
			continue;
		}
		for (align = 1;
		     (off % (align << 1)) == 0 && (align << 1) <= size;
		     align <<= 1)
			;
		for (i = off; i < off + align; i++)
			shm->free_space[i] = RTE_MAX(align, shm->free_space[i]);
		off += align;
	}
}
static void process_score ( void ) { size_t off , align , size , i ; for ( i = 0 ; i < sizeof ( struct rte_mbuf ) ; i ++ ) { if ( shm -> free_space [ i ] ) shm -> free_space [ i ] = 1 ; } off = 0 ; while ( off < sizeof ( struct rte_mbuf ) ) { for ( size = 0 ; ( off + size ) < sizeof ( struct rte_mbuf ) && shm -> free_space [ off + size ] ; size ++ ) ; if ( size == 0 ) { off ++ ; continue ; } for ( align = 1 ; ( off % ( align << 1 ) ) == 0 && ( align << 1 ) <= size ; align <<= 1 ) ; for ( i = off ; i < off + align ; i ++ ) shm -> free_space [ i ] = RTE_MAX ( align , shm -> free_space [ i ] ) ; off += align ; } }
Set the value of free_space[] according to the size and alignment of
 the free areas.
Set the value of free_space [] according to the size and alignment of the free areas .
/* first, erase previous info */ /* get the size of the free zone */ /* get the alignment of biggest object that can fit in
		 * the zone at this offset.
		 */ /* save it in free_space[] */