Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2734991rda; Wed, 25 Oct 2023 10:42:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMvEu71wh/in52j0BBcLVoPRrpiQDQmzpFDdsxbjE/hul+G3nNam/U4rI8pw4XvSHpCoZ8 X-Received: by 2002:a05:6870:ed89:b0:1e9:f4e4:2882 with SMTP id fz9-20020a056870ed8900b001e9f4e42882mr20882781oab.38.1698255776238; Wed, 25 Oct 2023 10:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698255776; cv=none; d=google.com; s=arc-20160816; b=Z1EtC9y5GcHtRzz9JdUEAxAl8rn9XMTHi97P/AKbvgy4fDLk01lxrONKpBDtUIjQGJ ic2En9i8EN7IO1Y2z+wjV5UZ7pzr7TUTRT6dO8dur1qU+/yNxg5+Jtj8DeMT7cfsYe26 uT3N5SUrNlmfwbsJRdGQaLHDM4dqyfA6RAS+E4tTF72V3/s/ir5ILaq1tB6AhzkCCpt5 xzwN+YOp5M7cxyA2K2ChgrN3A9d9pylMfDLRfNTpjad2fuTaJXs46iYeJWCh7WHWW+oQ YnE53ODZ20366F3GU7j5WsbledwFFlCmcHh0n2b3Fr70ot7MA2vlkTj5sluWky9zb6nF 19uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cBNaTjBwmD7DDb8oYXr337UXXRS17wg2IqMWRZnMrPs=; fh=uQU1mgGvrPhJxOy184+WDP15rty+Qu8Y+d0Hr/5rTyU=; b=zR9KIa+95+s3FYQFoF6krmGf1w1SnFGn+g+p1jgXiPui4zBXCX6Xrv8BArrRQ6I7R4 N3yOqLPaCawjlT1zT5oAmy5RL0bac/pc6M+vDDciofVAL2tK5Pmd+uO2pZYHIMUsVW4P /7iWwWTwrlRO7TdVNFLVmp8btd9Q3DgaXwM5zK3Ys3epqNWts96zsakE9zJPxt43nu2c WskbJFcNCka3uOmGckZ0UFdgnA4iJnuXRwzWmOcz9NQCjRH5xrL1ifs9gayXnCYA9KhS bUX6JGOwTaq/2fEXo/Ss6rNIY2L+WMWM6XHXoAscquClfEX79Tf/YJBNKqT5w4WZFoPW CbnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=a8ADbzxA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x5-20020a0dee05000000b005a210c45120si11500728ywe.535.2023.10.25.10.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=a8ADbzxA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A13B9807F4ED; Wed, 25 Oct 2023 10:41:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233247AbjJYRll (ORCPT + 99 others); Wed, 25 Oct 2023 13:41:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232270AbjJYRlj (ORCPT ); Wed, 25 Oct 2023 13:41:39 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57A2018D for ; Wed, 25 Oct 2023 10:41:35 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-507d7b73b74so8571815e87.3 for ; Wed, 25 Oct 2023 10:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1698255693; x=1698860493; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cBNaTjBwmD7DDb8oYXr337UXXRS17wg2IqMWRZnMrPs=; b=a8ADbzxA97WkVE7jEmgvzOP35ExZG5aEKw5LffNswukF9Em9Lei/Q4mPAgqRrl0SAh 1a4Nvm88a967sAuXajj4zZnilwgzuIYgpej3CWwi4jJPWJYnT7i4HM/kB8Z7v5sjg4RB NQRxHZs/n+dypH+lk97sE2B0KTiY+oAKZELtk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698255693; x=1698860493; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cBNaTjBwmD7DDb8oYXr337UXXRS17wg2IqMWRZnMrPs=; b=d9OAXqjAKjmhbDBom6cXk5OY2m4Ouao0Iei2dR48cX5SJMfNbRmbkC5VCRMFwNfZpx 393tY4eLvOxCgi2QONt6+gYmHoFuhObu2AotneFqiKT+NViaNTLkKzsFxJBTxcUbJ1+i ZctsaozhU8UFRUUb0LUPVmhT5BtT3RuwqBN0noPadJK83eBtls1o4K0rj6eZql/B5csz meF7teBfY7Xbz4gfl0kuQgn7AKfGTZzs1m9V4SnP8n1q0eMX1IJwlD0J0fPyGt6ZFxFv DKlL69t3zKv1TR+5PeIGjJ8aPFzSyUzV5XczI7RglKWki/I10obeZoTqkm4ywLhqatWC 0hmg== X-Gm-Message-State: AOJu0YwiQo3d/PgZILoc4VN+279CMOCGCvtS7JnN5U9FiFnB+0/Jqgox MAExz+66Aom4wc/oTiLY28iwg26whENDxYKC/VLc6A== X-Received: by 2002:ac2:485b:0:b0:507:9a33:f105 with SMTP id 27-20020ac2485b000000b005079a33f105mr11050461lfy.69.1698255693249; Wed, 25 Oct 2023 10:41:33 -0700 (PDT) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com. [209.85.208.49]) by smtp.gmail.com with ESMTPSA id d24-20020a170906041800b0099cb1a2cab0sm10329703eja.28.2023.10.25.10.41.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Oct 2023 10:41:32 -0700 (PDT) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-540105dea92so6961474a12.2 for ; Wed, 25 Oct 2023 10:41:32 -0700 (PDT) X-Received: by 2002:a17:906:fd45:b0:9c3:cefa:93c6 with SMTP id wi5-20020a170906fd4500b009c3cefa93c6mr7840525ejb.10.1698255692298; Wed, 25 Oct 2023 10:41:32 -0700 (PDT) MIME-Version: 1.0 References: <20231024161931.78567-1-sebastian.reichel@collabora.com> <20231024161931.78567-2-sebastian.reichel@collabora.com> <4c2d36375bd74d94a2e6ef5d2fa0df99@AcuMS.aculab.com> In-Reply-To: <4c2d36375bd74d94a2e6ef5d2fa0df99@AcuMS.aculab.com> From: Linus Torvalds Date: Wed, 25 Oct 2023 07:41:15 -1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/3] math.h: add DIV_ROUND_UP_NO_OVERFLOW To: David Laight Cc: Sebastian Reichel , Andy Shevchenko , Michael Turquette , Stephen Boyd , "linux-clk@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Vasily Gorbik , Niklas Schnelle , "kernel@collabora.com" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 25 Oct 2023 10:41:56 -0700 (PDT) On Tue, 24 Oct 2023 at 22:38, David Laight wrote: > > From: Linus Torvalds > > > - we can't even use a statement expression and __auto_type, because > > > these things are used in type definitions etc and need to be constant > > > expressions > > Doesn't min() get around that by using is_constexpr() and > __builtin_choose_exptr() - the same could be done here. Nope. I wanted to do it that way - it would have made things much simpler and avoid the whole _Generic() thing, but try it - you cannot use statement expressions in a non-function context even with __builtin_choose_expr(). And no, min/max have never been usable in that context Linus