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 EC1E4A0679 for ; Fri, 5 Apr 2019 22:07:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61F701B584; Fri, 5 Apr 2019 22:07:43 +0200 (CEST) Received: from vsmx009.vodafonemail.xion.oxcs.net (vsmx009.vodafonemail.xion.oxcs.net [153.92.174.87]) by dpdk.org (Postfix) with ESMTP id 35D351B582 for ; Fri, 5 Apr 2019 21:20:28 +0200 (CEST) Received: from vsmx001.vodafonemail.xion.oxcs.net (unknown [192.168.75.191]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id DB5E2C0166; Fri, 5 Apr 2019 19:20:27 +0000 (UTC) Received: from H270 (unknown [91.56.249.238]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 3FD5A3002C5; Fri, 5 Apr 2019 19:20:21 +0000 (UTC) Message-ID: <992998AF3ADA4F28BBF7D7CC257A2034@H270> From: "Stefan Kanthak" To: "Pavan Nikhilesh Bhagavatula" , Cc: References: <0D8EBD99DC5246E394511624D3B09B10@W340> In-Reply-To: Date: Fri, 5 Apr 2019 21:17:53 +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: Fri, 05 Apr 2019 22:07:42 +0200 Subject: Re: [dpdk-dev] [BUG] Maintainer forlib/librte_eal/common/rte_reciprocal.c? 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: <20190405191753.zj6StHrx60esmfzAGkGjnhVx4Jaekl6BD4vMmUWeHEw@z> "Pavan Nikhilesh Bhagavatula" wrote Thursday, March 28, 2019 6:35 AM: > Hi Stefan, > > Thanks for the heads up, I am planning to use a modified version of > https://github.com/hcs0/Hackers-Delight/blob/master/divluh.c.txt > for simplicity as we don't require the remainder. Why don't you refer to the ORIGINAL source instead? BUT: you also shouldn't use these routines, they too show quite bad implementations of a binary division! As Don Knuth wrote in volume 2 of TAoCP, hardware implementations are most often NOT well-suited for implementation in software. Take a look at the following STRAIGHTFORWARD implementation, both in ANSI C and x86 assembly (for Microsoft's Visual C compiler): unsigned long long divide(unsigned long long dividendlow, unsigned long long dividendhigh, unsigned long long divisor, unsigned long long *remainder) { #ifndef _M_IX86 unsigned int shift = 64; do { if (dividendhigh < divisor) { dividendhigh <<= 1; dividendhigh |= dividendlow >> 63; dividendlow <<= 1; } else { dividendhigh -= divisor; dividendhigh <<= 1; dividendhigh |= dividendlow >> 63; dividendlow <<= 1; dividendlow |= 1; } } while (--shift != 0); if (*remainder != NULL) remainder = dividendhigh; return dividendlow; #else __asm { mov eax, dword ptr dividendlow mov edx, dword ptr dividendlow+4 mov ecx, dword ptr dividendhigh mov ebx, dword ptr dividendhigh+4 mov edi, dword ptr divisor mov esi, dword ptr divisor+4 mov ebp, 64 NEXT: cmp ebx, esi ja SUBTRACT jb SHIFT cmp ecx, edi jb SHIFT SUBTRACT: sub ecx, edi sbb ebx, esi SHIFT: cmc adc eax, eax adc edx, edx adc ecx, ecx adc ebx, ebx dec ebp jnz NEXT or ebp, remainder jz EXIT mov [ebp], ecx mov [ebp+4], ebx EXIT: } #endif } > -----Original Message----- > From: dev On Behalf Of Stefan Kanthak > Sent: Tuesday, March 26, 2019 6:41 AM > To: dev@dpdk.org > Cc: hannes@stressinduktion.org > Subject: [dpdk-dev] [BUG] Maintainer for > lib/librte_eal/common/rte_reciprocal.c? > > Hi @ll, > > does NOT list a maintainer > for lib/librte_eal/common/rte_reciprocal.c > > Whoever it is should take a close look at online.de/division.html>, > then fix the most obvious bug plus the many deficiencies of > divide_128_div_64_to_64(). > > regards > Stefan Kanthak