Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2018 09:31:34 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Warner Losh <imp@bsdimp.com>, "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc:        Allan Jude <allanjude@freebsd.org>, Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r340450 - head/sys/sys
Message-ID:  <5e227743-6463-d395-f2ba-da8d4ba248ca@FreeBSD.org>
In-Reply-To: <CANCZdfoGKKcL70ESKow=hfNABpO=5%2BQtUYcNmpt4gReRkeUvrA@mail.gmail.com>
References:  <CANCZdfqr=R-MCpDEGWDqGYJbcQ46Hqw7PMrVinAsYTRPjLjJPA@mail.gmail.com> <201811190104.wAJ14CaE059062@pdx.rh.CN85.dnsmgr.net> <CANCZdfoGKKcL70ESKow=hfNABpO=5%2BQtUYcNmpt4gReRkeUvrA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 19/11/2018 03:38, Warner Losh wrote:
> I'll talk to Allan to see if he can test that. the bare 1 should be handled
> properly because of C's promotion rules. 1ull << 32 is an unsigned long long.
> What I really wanted was "~(uint32_t)0" but that construct has bit me in the past.

I think that you could just do (unsigned int)-1 or UINT_MAX.

As a side note, I wonder if those functions are ever used on negative values,
given the type of the argument, and if anyone checked their correctness in that
case.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5e227743-6463-d395-f2ba-da8d4ba248ca>