Small typo + feature request for SystemStats


#1

In the latest master juce_SystemStats.h, line 159:

static bool hasSSE3() noexcept;  /**< Returns true if Intel SSE2 instructions are available. */

I'm pretty sure that comment is supposed to say "...if Intel SSE3 instructions..." instead of SSE2. It also appears this way on the JUCE documentation site.

Feature request: can we also get checks for SSE4.1+4.2 and AVX2? Adding these would be trivial, I'd do it myself but you don't take pull requests.

juce_win32_SystemStats.cpp, 111:

hasSSE41 = (info[2] & (1 << 19)) != 0;
hasSSE42 = (info[2] & (1 << 20)) != 0;

callCPUID (info, 7);

hasAVX2 = (info[1] & (1 << 5)) != 0;

juce_mac_SystemStats.cpp, 84:

hasSSE41 = (c & (1u << 19)) != 0;
hasSSE42 = (c & (1u << 20)) != 0;

SystemStatsHelpers::doCPUID (a, b, c, d, 7);

hasAVX2 = (b & (1u << 5)) != 0;

juce_linux_SystemStats.cpp, 159:

hasSSE41 = flags.contains ("sse4_1");
hasSSE42 = flags.contains ("sse4_2");
hasAVX2 = flags.contains ("avx2");

These would of course also have their respective bools and hasSSE41(), hasSSE42(), and hasAVX2() functions as well. It would be nice if SystemStats could just cover all CPU flags since they're never going to change and get added infrequently, but I digress.


#2

Hi Jon,

I've fixed the typo in the latest commit and also added the flags that you suggested. Thank you for reporting this. 

Fabian