shithub: opus-tools

Download patch

ref: e1c51f6588b6b65991a23355006328c1a2e1f113
parent: 6b417dcb17b34b94da49cbb5b35b50be9beaf30e
author: Ralph Giles <giles@mozilla.com>
date: Mon Dec 17 10:17:15 EST 2012

Document the intent of the #ifdefs around query_cpu_support.

I found the code bypassing the query definition both when
SSE isn't available _and_ on x86_64, where it is unconditionally
available, confusing. That's not what I expected from general
cpuid reporting implementation.

Instead, it's specialized to the code's use only to warn before
the user hits an invalid instruction, so it makes sense to disable
it in those particular cases.

Thanks to Greg Maxwell for explaining what was going on.

--- a/src/cpusupport.h
+++ b/src/cpusupport.h
@@ -29,6 +29,10 @@
 #ifndef OPUSTOOLS_CPUSUPPORT_H
 # define OPUSTOOLS_CPUSUPPORT_H
 
+/* We want to warn if we're built with SSE support, but running
+   on a host without those instructions. Therefore we disable
+   the query both if the compiler isn't supporting SSE, and on
+   targets which are guaranteed to have SSE. */
 # if !defined(__SSE__) || defined(_M_X64) || defined(__amd64__)
 #  define query_cpu_support() 0
 # else