tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 64-bit masks



On Sat, 28 Nov 2009, Izumi Tsutsui wrote:

> > > 1. What is the correct (portable?) way of specifying 64-bit constants?
> > >
> > > If I need a 64-bit constant set to all 1s, will the following work on all
> > > systems
> > >
> > > unit64_t num = 0xffffffffffffffffULL;
> >
> > I would use ~0ULL.
>
> BTW, UINT64_MAX is in <machine/int_limits.h>,
> though it doesn't imply bitmask ops.

also __BITS(0, 63) from <sys/cdefs.h> which does imply bitmask ops (though
I'm not sure if it is ok for the case where "nbits(uintmax_t) < 64"

iain




Home | Main Index | Thread Index | Old Index