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: <7225a8ed-8502-48b5-a39f-870b444d069c@linux.dev>
Date: Tue, 15 Jul 2025 13:36:33 -0400
From: Sean Anderson <sean.anderson@...ux.dev>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
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 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);

--Sean

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ