[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=NkgtT+mO4YUoqcNx3cXM1G2nJ2Y4rXihdT0paqW2QYA@mail.gmail.com>
Date: Sat, 15 Jul 2023 18:59:10 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: lina@...hilina.net, alex.gaynor@...il.com, asahi@...ts.linux.dev,
bjorn3_gh@...tonmail.com, boqun.feng@...il.com, gary@...yguo.net,
gbs@...ishe.com, heghedus.razvan@...tonmail.com,
jistone@...hat.com, jstultz@...gle.com,
linux-kernel@...r.kernel.org, ojeda@...nel.org,
rust-for-linux@...r.kernel.org, sboyd@...nel.org,
tglx@...utronix.de, wedsonaf@...il.com
Subject: Re: [PATCH v2] rust: time: New module for timekeeping functions
On Fri, Jul 14, 2023 at 12:05 PM Alice Ryhl <aliceryhl@...gle.com> wrote:
>
> In that case, you should explicitly use `.wrapping_sub` instead to
> convey your intent.
Also to prevent extra code and panics with `CONFIG_RUST_OVERFLOW_CHECKS=y`.
> I guess you could also use `abs_diff`, which takes two i64s and returns
> an u64.
I think `abs_diff` sounds best. It introduces an extra branch in its
implementation from what I see, though...
However, since it is the same branch that Lina does for returning
`None`, it should be getting removed. At least in a quick test, LLVM
generates the same code: https://godbolt.org/z/61rafzx71
Cheers,
Miguel
Powered by blists - more mailing lists