-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
Corrade::Cpu | ||
— compile-time and runtime CPU feature detection and dispatch | ||
https://doc.magnum.graphics/corrade/namespaceCorrade_1_1Cpu.html | ||
This is a single-header library generated from the Corrade project. With | ||
the goal being easy integration, it's deliberately free of all comments | ||
to keep the file size small. More info, detailed changelogs and docs here: | ||
- Project homepage — https://magnum.graphics/corrade/ | ||
- Documentation — https://doc.magnum.graphics/corrade/ | ||
- GitHub project page — https://github.com/mosra/corrade | ||
- GitHub Singles repository — https://github.com/mosra/magnum-singles | ||
To avoid bloat from OS-specific headers, this library contains a deinlined | ||
implementation part, in particular for runtime feature detection on ARM. | ||
Dedicate *exactly one* file in your project and add the following to it: | ||
#define CORRADE_CPU_IMPLEMENTATION | ||
#include "CorradeCpu.h" | ||
If you need the deinlined symbols to be exported from a shared library, | ||
#define CORRADE_UTILITY_EXPORT as appropriate. To enable the IFUNC | ||
functionality, #define CORRADE_CPU_USE_IFUNC before including the file. | ||
v2020.06-1015-g8cbd6 (2022-08-02) | ||
- Initial release | ||
Generated from Corrade {{revision}}, {{stats:loc}} / {{stats:preprocessed}} LoC | ||
*/ | ||
|
||
#include "base.h" | ||
|
||
/* Detect platforms based on preprocessor defines. Corrade itself does that | ||
through CMake and bakes that into configure.h, which we can't do here. */ | ||
/* https://stackoverflow.com/a/8249232 */ | ||
#ifdef __ANDROID__ | ||
#define CORRADE_TARGET_ANDROID | ||
#endif | ||
/* https://stackoverflow.com/a/41508246 */ | ||
#ifdef __EMSCRIPTEN__ | ||
#define CORRADE_TARGET_EMSCRIPTEN | ||
#endif | ||
/* https://stackoverflow.com/a/8249232 */ | ||
#ifdef __APPLE__ | ||
#define CORRADE_TARGET_APPLE | ||
#endif | ||
|
||
/* Supply the configure.h template instead to avoid using baked-in defines */ | ||
#include "Corrade/configure.h.cmake" | ||
#pragma ACME enable Corrade_configure_h | ||
|
||
/* Contains just Cpu::Features forward declaration, which we don't need */ | ||
#pragma ACME enable Corrade_Corrade_h | ||
|
||
/* We need just the INLINE macros and _CORRADE_HELPER_PASTE2 */ | ||
#pragma ACME enable Corrade_Utility_Macros_h | ||
#ifndef CorradeCpu_h | ||
#define CorradeCpu_h | ||
#ifdef CORRADE_TARGET_GCC | ||
#define CORRADE_ALWAYS_INLINE __attribute__((always_inline)) inline | ||
#elif defined(CORRADE_TARGET_MSVC) | ||
#define CORRADE_ALWAYS_INLINE __forceinline | ||
#else | ||
#define CORRADE_ALWAYS_INLINE inline | ||
#endif | ||
|
||
#ifdef CORRADE_TARGET_GCC | ||
#define CORRADE_NEVER_INLINE __attribute__((noinline)) | ||
#elif defined(CORRADE_TARGET_MSVC) | ||
#define CORRADE_NEVER_INLINE __declspec(noinline) | ||
#else | ||
#define CORRADE_NEVER_INLINE | ||
#endif | ||
|
||
#define _CORRADE_HELPER_PASTE2(a, b) a ## b | ||
|
||
/* For the deinlined runtimeFeatures() implementation on ARM */ | ||
#ifndef CORRADE_UTILITY_EXPORT | ||
#define CORRADE_UTILITY_EXPORT | ||
#endif | ||
#endif | ||
#include "Corrade/Cpu.h" | ||
#ifdef CORRADE_CPU_IMPLEMENTATION | ||
// {{includes}} | ||
#include "Corrade/Cpu.cpp" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters