lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DDZ51VBAJJ5X.2V6GT3H8O1MM@nvidia.com>
Date: Mon, 03 Nov 2025 23:44:20 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Yury Norov" <yury.norov@...il.com>, "Miguel Ojeda"
 <miguel.ojeda.sandonis@...il.com>
Cc: "Alexandre Courbot" <acourbot@...dia.com>, "Alice Ryhl"
 <aliceryhl@...gle.com>, "Danilo Krummrich" <dakr@...nel.org>, "Miguel
 Ojeda" <ojeda@...nel.org>, "Joel Fernandes" <joelagnelf@...dia.com>,
 "Jesung Yang" <y.j3ms.n@...il.com>, "Boqun Feng" <boqun.feng@...il.com>,
 "Gary Guo" <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Trevor Gross" <tmgross@...ch.edu>,
 <linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH 1/2] rust: add BitInt integer wrapping type

On Mon Nov 3, 2025 at 11:26 PM JST, Yury Norov wrote:
> On Mon, Nov 03, 2025 at 03:10:01PM +0100, Miguel Ojeda wrote:
>> On Mon, Nov 3, 2025 at 3:17 AM Yury Norov <yury.norov@...il.com> wrote:
>> >
>> > Rust _must_ do the same thing to at least be arithmetically
>> > compatible to the big brother.
>> 
>> No, Rust doesn't need to do anything of the sort, sorry.
>> 
>> The point here is not to copy what C does, but to improve on it.
>> 
>> In particular, we definitely do not want to have anything like integer
>> promotions and arithmetic conversions from C.
>
> This is exactly what the patch does:
>
>   +/// let v = BitInt::<u8, 4>::from_expr(15);
>   +///
>   +/// // Common operations are supported against the backing type.
>   +/// assert_eq!(v + 5, 20);
>   +/// assert_eq!(v / 3, 5);

That's incorrect. `v` is backed by a u8, thus the RHS `5` is also a u8
(and so is the result, `20`).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ