This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, LIBGCC] Avoid count_leading_zeros with undefined result (PR 78067)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: James Greenhalgh <james dot greenhalgh at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Ian Lance Taylor <ian at airs dot com>, Bernd Schmidt <bschmidt at redhat dot com>, "nd at arm dot com" <nd at arm dot com>
- Date: Wed, 9 Nov 2016 22:16:35 +0000
- Subject: Re: [PATCH, LIBGCC] Avoid count_leading_zeros with undefined result (PR 78067)
- Authentication-results: sourceware.org; auth=none
- References: <HE1PR0701MB21698B2BB65F953F78D09E02E4AA0@HE1PR0701MB2169.eurprd07.prod.outlook.com> <alpine.DEB.2.20.1610272023230.22353@digraph.polyomino.org.uk> <AM4PR0701MB2162694CBC5F228F4E037D9CE4AD0@AM4PR0701MB2162.eurprd07.prod.outlook.com> <AM4PR0701MB2162CCD9B18CE6257F940378E4AC0@AM4PR0701MB2162.eurprd07.prod.outlook.com> <20161109163230.GA14336@arm.com> <alpine.DEB.2.20.1611091651220.7263@digraph.polyomino.org.uk> <AM4PR0701MB2162FD51FE06899EC581CE21E4B90@AM4PR0701MB2162.eurprd07.prod.outlook.com>
On Wed, 9 Nov 2016, Bernd Edlinger wrote:
> Yes, but maybe introduce a test if the half-wide value fits?
>
> like:
>
> #define M_OK2(M, T) ((M) > sizeof(T) * CHAR_BIT / 2 - 1)
Something like that.
--
Joseph S. Myers
joseph@codesourcery.com