From: David Laight <David.Laight@ACULAB.COM>
To: "'Hannes Frederic Sowa'" <hannes@stressinduktion.org>,
Christoph Lameter <cl@linux.com>
Cc: Daniel Borkmann <dborkman@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
Austin S Hemmelgarn <ahferroin7@gmail.com>,
"Jesse Gross" <jesse@nicira.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
"Stephen Hemminger" <stephen@networkplumber.org>,
Matt Mackall <mpm@selenic.com>,
"Pekka Enberg" <penberg@kernel.org>,
Andy Gospodarek <andy@greyhouse.net>,
"Veaceslav Falico" <vfalico@redhat.com>,
Jay Vosburgh <fubar@us.ibm.com>,
Jakub Zawadzki <darkjames-ws@darkjames.pl>
Subject: RE: [PATCH net-next 2/2] reciprocal_divide: correction/update of the algorithm
Date: Fri, 17 Jan 2014 10:05:37 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D45EB06@AcuExch.aculab.com> (raw)
In-Reply-To: <20140116172406.GA17529@order.stressinduktion.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1349 bytes --]
From: Hannes Frederic Sowa
> On Thu, Jan 16, 2014 at 10:37:37AM -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?
>
> Sure, that works and I actually like it. This is supported by the c standard,
> but please don't ask me since which one. ;)
I think it has always been supported.
Originally by adding an extra hidden argument that points to an on-stack
structure.
More recent ABI tend to allow 'small' structures be returned in registers.
(Typically ones that would fit in the register(s) used for an integral result).
This doesn't mean that it is a good idea!
OTOH if the function is 'static inline' (and inlined) it probably doesn't matter.
David
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2014-01-17 10:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 23:23 [PATCH net-next 0/2] reciprocal_divide updates Daniel Borkmann
2014-01-15 23:23 ` [PATCH net-next 1/2] random32: add prandom_u32_lt_N and convert "misuses" of reciprocal_divide Daniel Borkmann
2014-01-16 0:29 ` Joe Perches
2014-01-16 9:22 ` Daniel Borkmann
2014-01-16 3:14 ` Eric Dumazet
2014-01-16 9:28 ` David Laight
2014-01-16 9:30 ` Daniel Borkmann
2014-01-15 23:23 ` [PATCH net-next 2/2] reciprocal_divide: correction/update of the algorithm Daniel Borkmann
2014-01-16 0:17 ` Ben Hutchings
2014-01-16 0:46 ` Hannes Frederic Sowa
2014-01-16 3:07 ` Eric Dumazet
2014-01-16 10:26 ` Hannes Frederic Sowa
2014-01-16 16:37 ` Christoph Lameter
2014-01-16 17:24 ` Hannes Frederic Sowa
2014-01-17 10:05 ` David Laight [this message]
2014-01-16 18:50 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=063D6719AE5E284EB5DD2968C1650D6D45EB06@AcuExch.aculab.com \
--to=david.laight@aculab.com \
--cc=ahferroin7@gmail.com \
--cc=andy@greyhouse.net \
--cc=cl@linux.com \
--cc=darkjames-ws@darkjames.pl \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=fubar@us.ibm.com \
--cc=hannes@stressinduktion.org \
--cc=jesse@nicira.com \
--cc=jhs@mojatatu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=stephen@networkplumber.org \
--cc=vfalico@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®