From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754401AbbKBVay (ORCPT ); Mon, 2 Nov 2015 16:30:54 -0500 Received: from mail-oi0-f50.google.com ([209.85.218.50]:33170 "EHLO mail-oi0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754322AbbKBVas (ORCPT ); Mon, 2 Nov 2015 16:30:48 -0500 MIME-Version: 1.0 In-Reply-To: References: <20151027.233235.1641084823622810663.davem@davemloft.net> <5637C8DF.800@kernel.org> From: Andy Lutomirski Date: Mon, 2 Nov 2015 13:30:28 -0800 Message-ID: Subject: Re: [GIT] Networking To: Linus Torvalds Cc: Andy Lutomirski , David Miller , Hannes Frederic Sowa , Andrew Morton , Network Development , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 2, 2015 at 1:19 PM, Linus Torvalds wrote: > On Mon, Nov 2, 2015 at 1:16 PM, Linus Torvalds > wrote: >> On Mon, Nov 2, 2015 at 12:34 PM, Andy Lutomirski wrote: >>> >>> Getting overflow checking right in more complicated cases is a PITA. >> >> No it is not. Not for unsigned values. > > Just to clarify. The "oevrflow" test for unsigned subtracts of "a-b" > (it's really an underflow, but whatever) really is just > > (b > a) > > Really. That's it. Claiming that that is "complicated" and needs a > helper function is not something sane people do. A fifth-grader that > isn't good at math can understand that. > > In contrast, nobody sane understands "usub_overflow(a, b, &res)". > > So really. Stop making inane arguments. I'll stop making inane arguments if you stop bashing arguments I didn't make. :) I said the helpers were useful for multiplication (by which I meant both signed and unsigned) and, to a lesser extent, for signed addition and subtraction. I don't believe I even tried to justify usub_overflow as anything other than an extremely minor optimization that probably isn't worthwhile. --Andy, who still has inline asm that does 'cmovo' and such in his code for work, sigh.