On 2012/04/21 19:21, Jonathan Neuschäfer <j.neuschae...@gmx.net> wrote:
> On Sat, Apr 21, 2012 at 01:29:37PM +0200, Jurgen Kramer wrote:
> > +struct dsdiff_header_dsf {
> > +   struct dsdiff_id id;            /* "DSD " */
> > +   uint32_t size_low, size_high;   /* DSD chunk size, including id = 28 */
> > +   uint32_t fsize_low, fsize_high; /* Total file size */
> > +   uint32_t pmeta_low, pmeta_high; /* Pointer to id3v2 metadata, should be
> > +                                      at the end of the file */
> > +};
> 
> What's the reason for not using uint64_t?

Because it might be misaligned, due to sizeof(dsdiff_id)==4, and some
CPUs may require 64 bit reads and 64 bit alignment, or MPD gets killed
with SIGBUS.

But since this struct is not explicitly "packed" (something which is
only possible with compiler extensions), the compiler would choose to
add a hole of 4 bytes after the dsdiff_id.

> > +   /* Check bits per sample format, determine if bitreverse is needed */
> > +   metadata->bitreverse = dsf_fmt_chunk.bitssample == 1 ?  true : false;
> 
> @Max: Would it make sense to directly assign the value, which the '=='
> operator returned?

Correct.  Less code and easier to read.

Max

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to