Fix illegal instruction in libaudio.dylib on OSX

This file gets included by AudioHRTF_avx512.cpp, which contains code
that should only be getting executed on CPUs with the appropriate support.

Unfortunately, when that file is compiled with -mavx512f, GCC also generates
AVX instructions in the code that initializes the value of SQUARE_ROOT_OF_2,
and this crashes on CPUs without AVX because it runs unconditionally.

Avoid the issue entirely by just making it a constant so no code needs to
be run.
This commit is contained in:
Dale Glass 2020-06-25 19:31:46 +02:00
parent f6ee158731
commit bc2c6a280d

View file

@ -28,8 +28,8 @@ const float ARCSECONDS_PER_ARCMINUTE = 60.0f;
const float ARCSECONDS_PER_DEGREE = ARCMINUTES_PER_DEGREE * ARCSECONDS_PER_ARCMINUTE;
const float EPSILON = 0.000001f; //smallish positive number - used as margin of error for some computations
const float SQUARE_ROOT_OF_2 = (float)sqrt(2.0f);
const float SQUARE_ROOT_OF_3 = (float)sqrt(3.0f);
const float SQUARE_ROOT_OF_2 = 1.414214f;
const float SQUARE_ROOT_OF_3 = 1.732051f;
const float METERS_PER_DECIMETER = 0.1f;
const float METERS_PER_CENTIMETER = 0.01f;
const float METERS_PER_MILLIMETER = 0.001f;