Date: Sat, 13 Jan 2018 11:34:14 -0600 From: Kyle Evans <kevans91@ksu.edu> To: Eitan Adler <lists@eitanadler.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: 1 << 31 redux Message-ID: <CACNAnaF-PiiG5nfOqc=zXwrHj%2BMs94SfWAaoF_VP8agz1CXLxA@mail.gmail.com> In-Reply-To: <CAF6rxg=GbfpBfPAAJg0RvpMrWW8p%2B0Ayf_Zd9i7Em2kOijFCjA@mail.gmail.com> References: <CAF6rxg=GbfpBfPAAJg0RvpMrWW8p%2B0Ayf_Zd9i7Em2kOijFCjA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 11, 2018 at 6:03 AM, Eitan Adler <lists@eitanadler.com> wrote: > Hi all, > > A few years ago I fixed most of the cases where we used 1 << 31 in FreeBSD. > This expression is illegal in C. Since then the issue has arisen again. > > https://reviews.freebsd.org/D13858 fixed most of the non-contrib cases. > > I'd also like to see if we could find some more general solution, be it a > compiler warning, bit set macro, or otherwise. > For what it's worth, I've really come to like and appreciate NetBSD's approach with __BIT/__BITS. See [1] for implementation, [2] for usage. [1] http://src.illumos.org/source/xref/netbsd-src/sys/sys/cdefs.h#577 [2] http://src.illumos.org/source/xref/netbsd-src/sys/arch/arm/sunxi/sunxi_usbphy.c#L44
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaF-PiiG5nfOqc=zXwrHj%2BMs94SfWAaoF_VP8agz1CXLxA>