From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH 2/2] eal: add u64 bit variant for reciprocal Date: Tue, 29 Aug 2017 12:38:00 -0700 Message-ID: <20170829123800.066ee293@xeon-e3> References: <1504032378-5483-1-git-send-email-pbhagavatula@caviumnetworks.com> <1504032378-5483-2-git-send-email-pbhagavatula@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, cristian.dumitrescu@intel.com To: Pavan Nikhilesh Return-path: Received: from mail-pg0-f41.google.com (mail-pg0-f41.google.com [74.125.83.41]) by dpdk.org (Postfix) with ESMTP id 5D4A7137C for ; Tue, 29 Aug 2017 21:38:03 +0200 (CEST) Received: by mail-pg0-f41.google.com with SMTP id b8so13537410pgn.5 for ; Tue, 29 Aug 2017 12:38:03 -0700 (PDT) In-Reply-To: <1504032378-5483-2-git-send-email-pbhagavatula@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 30 Aug 2017 00:16:18 +0530 Pavan Nikhilesh wrote: > +static inline uint64_t > +mullhi_u64(uint64_t x, uint64_t y) > { > - uint32_t t = (uint32_t)(((uint64_t)a * R.m) >> 32); > + __uint128_t xl = x; > + __uint128_t yl = y; > + __uint128_t rl = xl * yl; > + return (uint64_t)(rl >> 64); > +} Cast in return not necessary. And cast when setting t not necessary. Please blank line after declarations. Also you don't need to cast both sides of multiply. Some compilers maybe able to optimize 128 bit * 64 bit.