From 36df25b7bc4971f5a35da1f202fcd21033a066b9 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Tue, 13 Feb 2018 14:19:25 +0100 Subject: [PATCH] Add to examples where needed, pluse minor stylistic touch-up. --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5966390..9a3e7df 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ AES and the SSE4.2 instruction sets: static const X86Features features = GetX86Info().features; void Compute(void) { - if(features.aes && features.sse4_2) { + if (features.aes && features.sse4_2) { // Run optimized code. } else { // Run standard code. @@ -55,6 +55,7 @@ then query for the specific features you care about. Below, we store all the ARM features and then check whether AES and NEON are supported. ```c +#include #include "cpuinfo_arm.h" static const ArmFeatures features = GetArmInfo().features; @@ -73,6 +74,7 @@ The following code determines whether the compiler was told to use the AVX instruction set (e.g., `g++ -mavx`) and sets `has_avx` accordingly. ```c +#include #include "cpuinfo_x86.h" static const X86Features features = GetX86Info().features; @@ -87,13 +89,14 @@ use AVX and 0 otherwise, combining compile time and runtime knowledge. ### Rejecting poor hardware implementations based on microarchitecture On x86, the first incarnation of a feature in a microarchitecture might not be -the most efficient (e.g., AVX on Sandy Bridge). We provide a function to -retrieve the underlying microarchitecture so you can decide whether to use it. +the most efficient (e.g. AVX on Sandy Bridge). We provide a function to retrieve +the underlying microarchitecture so you can decide whether to use it. Below, `has_fast_avx` is set to 1 if the CPU supports the AVX instruction set—but only if it's not Sandy Bridge. ```c +#include #include "cpuinfo_x86.h" static const X86Info info = GetX86Info(); @@ -154,4 +157,4 @@ See [LICENSE](LICENSE) for more information. ## Build with CMake -Please check the [CMake build instructions](cmake/README.md) +Please check the [CMake build instructions](cmake/README.md).