From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B0173FB0E; Mon, 2 Jun 2025 09:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748857182; cv=none; b=mZX7fxm5HCvyWvoA5yeuRyaDZauOSbJ4DSilO20LZOPC1stVPdJcZwAmP8d4VKKnawhbT/AWm4mryiYzVWNwniseJZCNlHVjrr/26YC48alDo0G8Ab3Vn0DoH9mFj4u7nywUallvomNQWirtHDQ+1aDUSwCW4D3VlY2wjN8rba8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748857182; c=relaxed/simple; bh=EpczvPljsIHCCSerQ8PlUVESAr97xCCeUPVmwWEVuko=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ibCB9TNNZh3x11OiOCPnswDWh8I8nSKbrE8IzpbkTLEOovvbz6xFptmlcAr9xx+PtLbmViIygXDus4/Z6TkO1LwvYCBlmTN54rMYPauY4mQ1gwdxfZC1UwByfY8R55w4OMyjJoQB41finvBI7z7us8MfJy698U41i3wIufJwaFA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ODV/5L/u; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ODV/5L/u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A7BC4CEEB; Mon, 2 Jun 2025 09:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748857182; bh=EpczvPljsIHCCSerQ8PlUVESAr97xCCeUPVmwWEVuko=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ODV/5L/uN51j4TwraKZ3BycfSVRlESswLej+FDW09tuaWtYSdO6nPVR1qDSq0BnVj m/zXMgoP3AvYZabDO/9Yzp75n+qMBFO8JjLT8ZaMoLwTGZK2iZngAol/tbpaQZR2NK FlzG72XCHoT3DNr9I3f2g5rHrZUPxMBZQ0CFytRtiYBiNM1zhxKEgtYb64G7gL+XcB WPv+8YHjq3Qr2RyDfyBr3XZ4rvFCLIMju6+Red0wHTf/Cr5EPi7gx2FqlBASui+Mn3 +k1lyYd9cBaod5t0GFMU19xY/qkf0zyla2RkR4EUpufwgn+mbEXCrJ7dtHTtuXNiXk I0GolDOu0P+7w== Date: Mon, 2 Jun 2025 11:39:34 +0200 From: Danilo Krummrich To: Benno Lossin Cc: Alexandre Courbot , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , John Hubbard , Ben Skeggs , Joel Fernandes , Timur Tabi , Alistair Popple , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v4 04/20] rust: add new `num` module with useful integer operations Message-ID: References: <20250521-nova-frts-v4-0-05dfd4f39479@nvidia.com> <20250521-nova-frts-v4-4-05dfd4f39479@nvidia.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, May 29, 2025 at 09:27:33AM +0200, Benno Lossin wrote: > That's also fair, but we lose the constness of `next_multiple_of`, so > you can't use `align_up` in a const function. That might confuse people > and then they write their own const helper function... I'd prefer we use > all functions that are available in the stdlib. Considering that, what's the suggestion for this trait? I don't think we should have a trait with align_down() and fls() only and otherwise use next_multiple_of(), i.e. mix things up. I think we should either align with the Rust nomenclature - whatever this means for fls() - or implement the trait with all three methods.