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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aHd7srtaK9O-O73a@smile.fi.intel.com>
Date: Wed, 16 Jul 2025 13:15:14 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Sean Anderson <sean.anderson@...ux.dev>
Cc: Jonathan Cameron <jic23@...nel.org>, Jean Delvare <jdelvare@...e.com>,
	Guenter Roeck <linux@...ck-us.net>, linux-iio@...r.kernel.org,
	linux-hwmon@...r.kernel.org, Andy Shevchenko <andy@...nel.org>,
	Nuno Sá <nuno.sa@...log.com>,
	linux-kernel@...r.kernel.org, David Lechner <dlechner@...libre.com>
Subject: Re: [PATCH 1/7] math64: Add div64_s64_rem

On Tue, Jul 15, 2025 at 01:36:33PM -0400, Sean Anderson wrote:
> On 7/15/25 04:03, Andy Shevchenko wrote:
> > On Mon, Jul 14, 2025 at 09:20:17PM -0400, Sean Anderson wrote:
> >> Add a function to do signed 64-bit division with remainder. This is
> >> implemented using div64_u64_rem in the same way that div_s64_rem is
> >> implemented using div_u64_rem.
> > 
> > LGTM, but one important Q. Can we (start to) add the test cases, please?
> 
> Well, this just calls div64_u64_rem. So I am inclined to make the test something
> like
> 
> #define test(n, d, q, r) ({ \
> 	u64 _q, _r; \
> 	_q = div64_u64_rem(n, d, &r); \
> 	assert(_q == q); \
> 	assert(_r == r); \
> })
> 
> test( 3,  2,  1,  1);
> test( 3, -2, -1,  1);
> test(-3,  2, -1, -1);
> test(-3, -2,  1, -1);

Perhaps, but it should be done somewhere in lib/tests/...

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ