Messages in this thread | | | Subject | Re: [PATCH net-next 2/2] reciprocal_divide: correction/update of the algorithm | From | Ben Hutchings <> | Date | Thu, 16 Jan 2014 18:50:39 +0000 |
| |
On Thu, 2014-01-16 at 10:37 -0600, Christoph Lameter wrote: > On Thu, 16 Jan 2014, Daniel Borkmann wrote: > > > - * or else the performance is slower than a normal divide. > > - */ > > -extern u32 reciprocal_value(u32 B); > > +struct reciprocal_value { > > + u32 m; > > + u8 sh1, sh2; > > +}; > > > > +#define RECIPROCAL_VALUE_RESULT_TO_ZERO ((struct reciprocal_value){.sh1 = 32}) > > > > -static inline u32 reciprocal_divide(u32 A, u32 R) > > +struct reciprocal_value reciprocal_value(u32 d); > > A function that returns a struct? That works? Which gcc versions support > it?
At least since gcc 1.29, given:
Thu Sep 22 15:57:41 1988 Richard Stallman (rms at sugar-bombs.ai.mit.edu) [...] * stmt.c (expand_function_start): Set current_function_needs_context and current_function_returns_struct.
Hope that's not a problem...
Ben.
-- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
| |