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]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ