[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] Warnings on 32 bit Fedora 24
From: |
Eric S. Raymond |
Subject: |
Re: [gpsd-dev] Warnings on 32 bit Fedora 24 |
Date: |
Fri, 22 Jul 2016 21:58:48 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Juha Nurmela <address@hidden>:
>
> > > fld &= ~(~0ULL << width)
>
> Isn't the ubits() function little bit dangerous?
Yes, if you don't know what you're doing.
> The prototype and comments look like that it promises to extract 64 bits wide
> fields, but it will quietly fail with unaligned really wide fields. Variable
> fld is asked to hold more than 64 bits in certain cases.
I wrote that function and most of its uses. If you grep for 'ubits(' and
'UBITS('in the code you will easily be able to verify that the longest field
width we extract with it is 42.
You might also want to take a look at the regression test for that kind
of function, in test_bits.c.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>