[NUT-devel] Another suggestion for broadcast [PATCH]

Måns Rullgård mans at mansr.com
Wed Feb 20 02:32:14 CET 2008


Rich Felker <dalias at aerifal.cx> writes:

> On Tue, Feb 19, 2008 at 07:50:27PM +0000, Måns Rullgård wrote:
>> Rich Felker <dalias at aerifal.cx> writes:
>> 
>> > On Tue, Feb 19, 2008 at 06:45:05PM +0100, Michael Niedermayer wrote:
>> >> +main_flags (v)
>> >> +    Bit Name            Description
>> >> +    0   BROADCAST_MODE  Set if broadcast mode is in use.
>> >
>> > Doesn't nut.txt say bit numbering goes from highest to lowest? Of
>> > course this makes no sense for vlc bitfields... But it should probably
>> > be clarified. Or else explicit numeric values rather than but numbers
>> > should be used.
>> 
>> Why not make each flag its own 1-bit field?  Or would that be bad for
>> some reason I'm missing?
>
> The flags fields are then not extensible. You have to keep adding more
> of them, possibly in discontiguous locations. Practically it just
> means slightly more wasted space in files not using obscure flags, but
> it's also ugly. I like vlc-flags better.

Another possibility is to precede each optional field with a 1-bit
flag indicating its presence.  The size of the containing element can
then also implicitly exclude any unused fields at the end.  This may
of course not be desired for frequently repeated elements where the
flags could be specified in a global header.

-- 
Måns Rullgård
mans at mansr.com



More information about the NUT-devel mailing list