From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vsmx012.vodafonemail.xion.oxcs.net (vsmx012.vodafonemail.xion.oxcs.net [153.92.174.90]) by dpdk.org (Postfix) with ESMTP id 843041B49A; Tue, 16 Apr 2019 11:20:34 +0200 (CEST) Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 161FEF34FB6; Tue, 16 Apr 2019 09:20:34 +0000 (UTC) Received: from H270 (unknown [91.56.240.67]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 3396A19A968; Tue, 16 Apr 2019 09:20:23 +0000 (UTC) Message-ID: <2851514C9E0449B4BA5C564727084D68@H270> From: "Stefan Kanthak" To: , Cc: , "Pavan Nikhilesh" , References: <20190414052325.15984-1-pbhagavatula@marvell.com> In-Reply-To: <20190414052325.15984-1-pbhagavatula@marvell.com> Date: Tue, 16 Apr 2019 11:07:47 +0200 Organization: Me, myself & IT MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.24158 X-VADE-STATUS: LEGIT X-Mailman-Approved-At: Tue, 16 Apr 2019 18:14:55 +0200 Subject: Re: [dpdk-dev] [PATCH] eal: fix large multiple calculation in reciprocal division X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2019 09:20:34 -0000 Pavan Nikhilesh wrote Sunday, April 14, 2019 7:22 AM: > From: Pavan Nikhilesh > > Fix large multiple calculation in 64 bit reciprocal division. This "fix" has a SERIOUS bug, it needs yet another fix. I recommend to understand code first before you copy it! [...] > + int64_t i; uint i = 64; > + uint64_t t; > + > + for (i = 1; i <= 64; i++) { do { > + t = x >> 63; t = (int64_t) x >> 63; // t is either 0ULL or ~0ULL > + x = (x << 1) | (y >> 63); > + y = y << 1; > + if ((x | t) >= z) { > + x = x - z; > + y = y + 1; > + } } while (--i > 0); Stefan Kanthak From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 4FC1DA00E6 for ; Tue, 16 Apr 2019 18:15:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ED8131B551; Tue, 16 Apr 2019 18:14:58 +0200 (CEST) Received: from vsmx012.vodafonemail.xion.oxcs.net (vsmx012.vodafonemail.xion.oxcs.net [153.92.174.90]) by dpdk.org (Postfix) with ESMTP id 843041B49A; Tue, 16 Apr 2019 11:20:34 +0200 (CEST) Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 161FEF34FB6; Tue, 16 Apr 2019 09:20:34 +0000 (UTC) Received: from H270 (unknown [91.56.240.67]) by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 3396A19A968; Tue, 16 Apr 2019 09:20:23 +0000 (UTC) Message-ID: <2851514C9E0449B4BA5C564727084D68@H270> From: "Stefan Kanthak" To: , Cc: , "Pavan Nikhilesh" , References: <20190414052325.15984-1-pbhagavatula@marvell.com> In-Reply-To: <20190414052325.15984-1-pbhagavatula@marvell.com> Date: Tue, 16 Apr 2019 11:07:47 +0200 Organization: Me, myself & IT MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format="flowed"; reply-type="original" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.24158 X-VADE-STATUS: LEGIT X-Mailman-Approved-At: Tue, 16 Apr 2019 18:14:55 +0200 Subject: Re: [dpdk-dev] [PATCH] eal: fix large multiple calculation in reciprocal division X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190416090747.lYczg0ipP7UkzKWMCmFzRAFIDJ1jfCMX2ftYYzkg4pI@z> Pavan Nikhilesh wrote Sunday, April 14, 2019 7:22 AM: > From: Pavan Nikhilesh > > Fix large multiple calculation in 64 bit reciprocal division. This "fix" has a SERIOUS bug, it needs yet another fix. I recommend to understand code first before you copy it! [...] > + int64_t i; uint i = 64; > + uint64_t t; > + > + for (i = 1; i <= 64; i++) { do { > + t = x >> 63; t = (int64_t) x >> 63; // t is either 0ULL or ~0ULL > + x = (x << 1) | (y >> 63); > + y = y << 1; > + if ((x | t) >= z) { > + x = x - z; > + y = y + 1; > + } } while (--i > 0); Stefan Kanthak