Messages in this thread | | | Subject | Re: [patch 1/2 -mm] flex_array: introduce DEFINE_FLEX_ARRAY | From | Dave Hansen <> | Date | Wed, 02 Sep 2009 10:26:42 -0700 |
| |
On Tue, 2009-09-01 at 20:14 -0700, David Rientjes wrote: > @@ -152,7 +136,8 @@ static unsigned int index_inside_part(struct > flex_array *fa, > { > unsigned int part_offset; > > - part_offset = element_nr % __elements_per_part(fa->element_size); > + part_offset = element_nr % > + FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size); > return part_offset * fa->element_size; > }
This all looks pretty good. The only issue is that the macro name lengths have gotten a bit out of hand.
For instance. This:
#define FLEX_ARRAY_ELEMENTS_PER_PART(size) \ (FLEX_ARRAY_PART_SIZE / size)
ends up being longer in practice than just open-coding the operation:
FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size)
vs.
(FLEX_ARRAY_PART_SIZE / fa->element_size)
and the length also ends up making for a couple of pretty ugly line wraps.
Otherwise, this is fine with me.
Acked-by: Dave Hansen <dave@linux.vnet.ibm.com>
-- Dave
| |