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: <CAK8P3a0b7_yMExXEiH-4sKnN2Smh+BDB+=dyNvPWVcLvR_zG5w@mail.gmail.com>
Date:   Sun, 21 Nov 2021 14:20:42 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Alejandro Colomar <alx.manpages@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Kees Cook <keescook@...omium.org>,
        Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v2 18/20] linux/power_of_2.h: Add __IS_POWER_OF_2(n) and
 __IS_POWER_OF_2_OR_0(n) macros

On Sat, Nov 20, 2021 at 2:01 PM Alejandro Colomar
<alx.manpages@...il.com> wrote:
> +
> +#define __IS_POWER_OF_2_OR_0(n)  (((n) & ((n) - 1)) == 0)
> +#define __IS_POWER_OF_2(n)       (__IS_POWER_OF_2_OR_0(n) && ((n) != 0))
> +

There is already is_power_of_2() in include/linux/log2.h, which would
be preferred
in most cases. If you need a macro version, put it in the same file
and explain why it's
needed.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ