From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbaAPSut (ORCPT ); Thu, 16 Jan 2014 13:50:49 -0500 Received: from webmail.solarflare.com ([12.187.104.25]:30752 "EHLO webmail.solarflare.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbaAPSuq (ORCPT ); Thu, 16 Jan 2014 13:50:46 -0500 Message-ID: <1389898239.11912.61.camel@bwh-desktop.uk.level5networks.com> Subject: Re: [PATCH net-next 2/2] reciprocal_divide: correction/update of the algorithm From: Ben Hutchings To: Christoph Lameter CC: Daniel Borkmann , , , , "Hannes Frederic Sowa" , Eric Dumazet , Austin S Hemmelgarn , Jesse Gross , Jamal Hadi Salim , Stephen Hemminger , Matt Mackall , Pekka Enberg , Andy Gospodarek , "Veaceslav Falico" , Jay Vosburgh , "Jakub Zawadzki" Date: Thu, 16 Jan 2014 18:50:39 +0000 In-Reply-To: References: <1389828228-30312-1-git-send-email-dborkman@redhat.com> <1389828228-30312-3-git-send-email-dborkman@redhat.com> Organization: Solarflare Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.6.4 (3.6.4-3.fc18) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.17.20.137] X-TM-AS-Product-Ver: SMEX-10.0.0.1412-7.000.1014-20438.001 X-TM-AS-Result: No--22.408400-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.