From: Luis Felipe Hernandez <luis.hernandez093@gmail.com>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: davidgow@google.com, Andrew Morton <akpm@linux-foundation.org>,
andriy.shevchenko@linux.intel.com, u.kleine-koenig@baylibre.com,
skhan@linuxfoundation.org, rbm@suse.com,
linux-kselftest@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
kunit-dev@googlegroups.com
Subject: Re: [PATCH v4] lib/math: Add int_sqrt test suite
Date: Tue, 10 Dec 2024 22:44:22 -0500 [thread overview]
Message-ID: <Z1kKlhUceHxZrMeS@x13> (raw)
In-Reply-To: <9op57qr3-p152-6ns7-52n6-35599801rq22@syhkavp.arg>
On Tue, Dec 10, 2024 at 02:59:12PM -0500, Nicolas Pitre wrote:
> This will fail on a 32-bit system where sizeof(long) == 32 and
> ULONG_MAX == 4294967295. (meaning the result would be 65535).
Thank you for taking the time to review my patch and for pointing out the issue with the ULONG_MAX test case. I failed to think about how a 32-bit system would treat ULONG_MAX == 4294967295.
To address this, I was thinking of updating the test case to use a large enough value that remains within the bounds of unsigned long for both 32-bit and 64-bit architectures instead. Specifically, 2147483648 (2^31), which has an integer square root of 46340. I believe this would ensure the test remains valid and portable across all supported architectures.
The updated test case would be as follows:
{ 2147483648, 46340, "large input"}
I'd appreciate any feedback on this proposed change and thanks again for your time Nicolas.
- Felipe
next prev parent reply other threads:[~2024-12-11 3:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 17:28 [PATCH v4] lib/math: Add int_sqrt test suite Luis Felipe Hernandez
2024-12-10 19:59 ` Nicolas Pitre
2024-12-11 3:44 ` Luis Felipe Hernandez [this message]
2024-12-11 3:58 ` Nicolas Pitre
2024-12-11 4:47 ` Luis Felipe Hernandez
2024-12-11 15:06 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1kKlhUceHxZrMeS@x13 \
--to=luis.hernandez093@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nico@fluxnic.net \
--cc=rbm@suse.com \
--cc=skhan@linuxfoundation.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.