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: <a1640e13-75b5-bc3c-74a6-5eaf6d74e7bc@infradead.org>
Date:   Thu, 3 Aug 2023 22:23:48 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        linux-kernel@...r.kernel.org
Cc:     Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v1 1/1] math.h: Document abs_diff()



On 8/3/23 22:09, Andy Shevchenko wrote:
> Initially abs_diff() has lack of documentation. Add it.
> 
> Suggested-by: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  include/linux/math.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/math.h b/include/linux/math.h
> index 336e3e3678e7..dfba59b59998 100644
> --- a/include/linux/math.h
> +++ b/include/linux/math.h
> @@ -155,6 +155,18 @@ __STRUCT_FRACT(u32)
>  	__builtin_types_compatible_p(typeof(x), unsigned type),		\
>  	({ signed type __x = (x); __x < 0 ? -__x : __x; }), other)
>  
> +/**
> + * abs_diff - return absolute value of the difference between the arguments
> + * @a: the first argument
> + * @b: the second argument
> + *
> + * @a and @b has to be of the same type. With this restriction we compare

Preferably s/has/have/.

> + * signed to signed and unsigned to unsigned. The result is the subtraction
> + * the smaller of the two from the bigger, hence result is always a positive
> + * value.
> + *
> + * Return: an absolute value of the difference between the @a and @b.
> + */
>  #define abs_diff(a, b) ({			\
>  	typeof(a) __a = (a);			\
>  	typeof(b) __b = (b);			\

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ