[flac-dev] PATCH for stream_encoder.c: change ifdefs order

lvqcl lvqcl.mail at gmail.com
Mon Feb 24 08:14:00 PST 2014


Erik de Castro Lopo wrote:

> Applied with minor reformatting.

Thanks. And btw, about reformatting: currently stream_encoder.c contains the following code:

#ifdef FLAC__SSSE3_SUPPORTED
	if(encoder->private_->cpuinfo.ia32.ssse3)
		aaaaa;
	else
#endif
#ifdef FLAC__SSE2_SUPPORTED
		bbbbb;
#endif

This code is correct because if FLAC__SSSE3_SUPPORTED is defined then
FLAC__SSE2_SUPPORTED is also defined (there are no compilers that support ssse3 but
don't support sse2), so there is no missing statement after 'else'. But imho
the following version is more easy to read:

#ifdef FLAC__SSE2_SUPPORTED
#  ifdef FLAC__SSSE3_SUPPORTED
	if(encoder->private_->cpuinfo.ia32.ssse3)
		aaaaa;
	else
#  endif
		bbbbb;
#endif

because this code doesn't depend on assumptions about FLAC__SSSE3_SUPPORTED
and FLAC__SSE2_SUPPORTED

The patch attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifdefs.patch
Type: application/octet-stream
Size: 1365 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20140224/fc0f3db9/attachment.obj 


More information about the flac-dev mailing list