{"id":13494549,"url":"https://github.com/google/cpu_features","last_synced_at":"2025-05-13T19:10:01.089Z","repository":{"id":37706453,"uuid":"119692633","full_name":"google/cpu_features","owner":"google","description":"A cross platform C99 library to get cpu features at runtime.","archived":false,"fork":false,"pushed_at":"2025-04-22T09:55:53.000Z","size":622,"stargazers_count":2510,"open_issues_count":39,"forks_count":281,"subscribers_count":1177,"default_branch":"main","last_synced_at":"2025-04-27T05:50:00.868Z","etag":null,"topics":["cpu","cpu-features","cross-platform","microarchitecture"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-31T13:44:50.000Z","updated_at":"2025-04-26T17:18:56.000Z","dependencies_parsed_at":"2024-05-01T22:11:19.239Z","dependency_job_id":"733df043-4fe5-447b-a9f0-a9746d844525","html_url":"https://github.com/google/cpu_features","commit_stats":{"total_commits":348,"total_committers":53,"mean_commits":6.566037735849057,"dds":0.5028735632183908,"last_synced_commit":"104602c8ae1dbaa250782e25449c6874809b6e12"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fcpu_features","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fcpu_features/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fcpu_features/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fcpu_features/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/cpu_features/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251094634,"owners_count":21535327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu","cpu-features","cross-platform","microarchitecture"],"created_at":"2024-07-31T19:01:25.949Z","updated_at":"2025-04-27T05:50:05.462Z","avatar_url":"https://github.com/google.png","language":"C++","readme":"# cpu_features\n\nA cross-platform C library to retrieve CPU features (such as available\ninstructions) at runtime.\n\n# GitHub-CI Status\n\n[comment]: \u003c\u003e (The following lines are generated by \"scripts/generate_badges.d\" that you can run online https://run.dlang.io/)\n\n|  | Linux | FreeBSD | MacOS | Windows |\n| :-- | --: | --: | --: | --: |\n| amd64 | [![CMake][i1a0]][l1a0]\u003cbr/\u003e[![Bazel][i1a1]][l1a1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | [![CMake][i3a0]][l3a0]\u003cbr/\u003e[![Bazel][i3a1]][l3a1] | [![CMake][i4a0]][l4a0]\u003cbr/\u003e[![Bazel][i4a1]][l4a1] |\n| AArch64 | [![CMake][i1b0]][l1b0]\u003cbr/\u003e[![Bazel][i1b1]][l1b1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n| ARM | [![CMake][i1c0]][l1c0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n| MIPS | [![CMake][i1d0]][l1d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n| POWER | [![CMake][i1e0]][l1e0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n| RISCV | [![CMake][i1f0]][l1f0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n| LOONGARCH | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n| s390x | [![CMake][i1h0]][l1h0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] | ![CMake][d0]\u003cbr/\u003e![Bazel][d1] |\n\n[d0]: https://img.shields.io/badge/n%2Fa-lightgrey?\u0026logo=cmake\n[d1]: https://img.shields.io/badge/n%2Fa-lightgrey?\u0026logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiAuMTZsNS43ODYgNS43ODZMNiAxMS43MzIuMjE0IDUuOTQ2IDYgLjE2MXpNMCA2LjIxNFYxMmw1Ljc4NiA1Ljc4NlYxMkwwIDYuMjE0ek0xOCAuMTZsNS43ODYgNS43ODZMMTggMTEuNzMybC01Ljc4Ni01Ljc4NkwxOCAuMTYxek0yNCA2LjIxNFYxMmwtNS43ODYgNS43ODZWMTJMMjQgNi4yMTR6TTEyIDYuMTZsNS43ODYgNS43ODZMMTIgMTcuNzMybC01Ljc4Ni01Ljc4NkwxMiA2LjE2MXpNMTEuODQgMTguMDU0djUuNzg1bC01Ljc4Ni01Ljc4NXYtNS43ODZsNS43ODUgNS43ODZ6TTEyLjE2IDE4LjA1NGw1Ljc4Ni01Ljc4NnY1Ljc4NmwtNS43ODUgNS43ODV2LTUuNzg1eiIgc3Ryb2tlPSJ0cmFuc3BhcmVudCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=\n[i1a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i1a1]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_linux_bazel.yml?branch=main\u0026event=push\u0026label=\u0026logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiAuMTZsNS43ODYgNS43ODZMNiAxMS43MzIuMjE0IDUuOTQ2IDYgLjE2MXpNMCA2LjIxNFYxMmw1Ljc4NiA1Ljc4NlYxMkwwIDYuMjE0ek0xOCAuMTZsNS43ODYgNS43ODZMMTggMTEuNzMybC01Ljc4Ni01Ljc4NkwxOCAuMTYxek0yNCA2LjIxNFYxMmwtNS43ODYgNS43ODZWMTJMMjQgNi4yMTR6TTEyIDYuMTZsNS43ODYgNS43ODZMMTIgMTcuNzMybC01Ljc4Ni01Ljc4NkwxMiA2LjE2MXpNMTEuODQgMTguMDU0djUuNzg1bC01Ljc4Ni01Ljc4NXYtNS43ODZsNS43ODUgNS43ODZ6TTEyLjE2IDE4LjA1NGw1Ljc4Ni01Ljc4NnY1Ljc4NmwtNS43ODUgNS43ODV2LTUuNzg1eiIgc3Ryb2tlPSJ0cmFuc3BhcmVudCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=\n[i1b0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/aarch64_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i1b1]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/aarch64_linux_bazel.yml?branch=main\u0026event=push\u0026label=\u0026logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiAuMTZsNS43ODYgNS43ODZMNiAxMS43MzIuMjE0IDUuOTQ2IDYgLjE2MXpNMCA2LjIxNFYxMmw1Ljc4NiA1Ljc4NlYxMkwwIDYuMjE0ek0xOCAuMTZsNS43ODYgNS43ODZMMTggMTEuNzMybC01Ljc4Ni01Ljc4NkwxOCAuMTYxek0yNCA2LjIxNFYxMmwtNS43ODYgNS43ODZWMTJMMjQgNi4yMTR6TTEyIDYuMTZsNS43ODYgNS43ODZMMTIgMTcuNzMybC01Ljc4Ni01Ljc4NkwxMiA2LjE2MXpNMTEuODQgMTguMDU0djUuNzg1bC01Ljc4Ni01Ljc4NXYtNS43ODZsNS43ODUgNS43ODZ6TTEyLjE2IDE4LjA1NGw1Ljc4Ni01Ljc4NnY1Ljc4NmwtNS43ODUgNS43ODV2LTUuNzg1eiIgc3Ryb2tlPSJ0cmFuc3BhcmVudCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=\n[i1c0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/arm_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i1d0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/mips_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i1e0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/power_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i1f0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/riscv_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i1h0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/s390x_linux_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i3a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_macos_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i3a1]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_macos_bazel.yml?branch=main\u0026event=push\u0026label=\u0026logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiAuMTZsNS43ODYgNS43ODZMNiAxMS43MzIuMjE0IDUuOTQ2IDYgLjE2MXpNMCA2LjIxNFYxMmw1Ljc4NiA1Ljc4NlYxMkwwIDYuMjE0ek0xOCAuMTZsNS43ODYgNS43ODZMMTggMTEuNzMybC01Ljc4Ni01Ljc4NkwxOCAuMTYxek0yNCA2LjIxNFYxMmwtNS43ODYgNS43ODZWMTJMMjQgNi4yMTR6TTEyIDYuMTZsNS43ODYgNS43ODZMMTIgMTcuNzMybC01Ljc4Ni01Ljc4NkwxMiA2LjE2MXpNMTEuODQgMTguMDU0djUuNzg1bC01Ljc4Ni01Ljc4NXYtNS43ODZsNS43ODUgNS43ODZ6TTEyLjE2IDE4LjA1NGw1Ljc4Ni01Ljc4NnY1Ljc4NmwtNS43ODUgNS43ODV2LTUuNzg1eiIgc3Ryb2tlPSJ0cmFuc3BhcmVudCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=\n[i4a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_windows_cmake.yml?branch=main\u0026event=push\u0026label=\u0026logo=cmake\n[i4a1]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_windows_bazel.yml?branch=main\u0026event=push\u0026label=\u0026logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiAuMTZsNS43ODYgNS43ODZMNiAxMS43MzIuMjE0IDUuOTQ2IDYgLjE2MXpNMCA2LjIxNFYxMmw1Ljc4NiA1Ljc4NlYxMkwwIDYuMjE0ek0xOCAuMTZsNS43ODYgNS43ODZMMTggMTEuNzMybC01Ljc4Ni01Ljc4NkwxOCAuMTYxek0yNCA2LjIxNFYxMmwtNS43ODYgNS43ODZWMTJMMjQgNi4yMTR6TTEyIDYuMTZsNS43ODYgNS43ODZMMTIgMTcuNzMybC01Ljc4Ni01Ljc4NkwxMiA2LjE2MXpNMTEuODQgMTguMDU0djUuNzg1bC01Ljc4Ni01Ljc4NXYtNS43ODZsNS43ODUgNS43ODZ6TTEyLjE2IDE4LjA1NGw1Ljc4Ni01Ljc4NnY1Ljc4NmwtNS43ODUgNS43ODV2LTUuNzg1eiIgc3Ryb2tlPSJ0cmFuc3BhcmVudCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=\n[l1a0]: https://github.com/google/cpu_features/actions/workflows/amd64_linux_cmake.yml\n[l1a1]: https://github.com/google/cpu_features/actions/workflows/amd64_linux_bazel.yml\n[l1b0]: https://github.com/google/cpu_features/actions/workflows/aarch64_linux_cmake.yml\n[l1b1]: https://github.com/google/cpu_features/actions/workflows/aarch64_linux_bazel.yml\n[l1c0]: https://github.com/google/cpu_features/actions/workflows/arm_linux_cmake.yml\n[l1d0]: https://github.com/google/cpu_features/actions/workflows/mips_linux_cmake.yml\n[l1e0]: https://github.com/google/cpu_features/actions/workflows/power_linux_cmake.yml\n[l1f0]: https://github.com/google/cpu_features/actions/workflows/riscv_linux_cmake.yml\n[l1h0]: https://github.com/google/cpu_features/actions/workflows/s390x_linux_cmake.yml\n[l3a0]: https://github.com/google/cpu_features/actions/workflows/amd64_macos_cmake.yml\n[l3a1]: https://github.com/google/cpu_features/actions/workflows/amd64_macos_bazel.yml\n[l4a0]: https://github.com/google/cpu_features/actions/workflows/amd64_windows_cmake.yml\n[l4a1]: https://github.com/google/cpu_features/actions/workflows/amd64_windows_bazel.yml\n\n## Table of Contents\n\n- [Design Rationale](#rationale)\n- [Code samples](#codesample)\n- [Running sample code](#usagesample)\n- [What's supported](#support)\n- [Android NDK's drop in replacement](#ndk)\n- [License](#license)\n- [Build with cmake](#cmake)\n- [Community Bindings](#bindings)\n\n\u003ca name=\"rationale\"\u003e\u003c/a\u003e\n## Design Rationale\n\n-   **Simple to use.** See the snippets below for examples.\n-   **Extensible.** Easy to add missing features or architectures.\n-   **Compatible with old compilers** and available on many architectures so it\n    can be used widely. To ensure that cpu_features works on as many platforms\n    as possible, we implemented it in a highly portable version of C: C99.\n-   **Sandbox-compatible.** The library uses a variety of strategies to cope\n    with sandboxed environments or when `cpuid` is unavailable. This is useful\n    when running integration tests in hermetic environments.\n-   **Thread safe, no memory allocation, and raises no exceptions.**\n    cpu_features is suitable for implementing fundamental libc functions like\n    `malloc`, `memcpy`, and `memcmp`.\n-   **Unit tested.**\n\n\u003ca name=\"codesample\"\u003e\u003c/a\u003e\n## Code samples\n\n**Note:** For C++ code, the library functions are defined in the `cpu_features` namespace.\n\n### Checking features at runtime\n\nHere's a simple example that executes a codepath if the CPU supports both the\nAES and the SSE4.2 instruction sets:\n\n```c\n#include \"cpuinfo_x86.h\"\n\n// For C++, add `using namespace cpu_features;`\nstatic const X86Features features = GetX86Info().features;\n\nvoid Compute(void) {\n  if (features.aes \u0026\u0026 features.sse4_2) {\n    // Run optimized code.\n  } else {\n    // Run standard code.\n  }\n}\n```\n\n### Caching for faster evaluation of complex checks\n\nIf you wish, you can read all the features at once into a global variable, and\nthen query for the specific features you care about. Below, we store all the ARM\nfeatures and then check whether AES and NEON are supported.\n\n```c\n#include \u003cstdbool.h\u003e\n#include \"cpuinfo_arm.h\"\n\n// For C++, add `using namespace cpu_features;`\nstatic const ArmFeatures features = GetArmInfo().features;\nstatic const bool has_aes_and_neon = features.aes \u0026\u0026 features.neon;\n\n// use has_aes_and_neon.\n```\n\nThis is a good approach to take if you're checking for combinations of features\nwhen using a compiler that is slow to extract individual bits from bit-packed\nstructures.\n\n### Checking compile time flags\n\nThe following code determines whether the compiler was told to use the AVX\ninstruction set (e.g., `g++ -mavx`) and sets `has_avx` accordingly.\n\n```c\n#include \u003cstdbool.h\u003e\n#include \"cpuinfo_x86.h\"\n\n// For C++, add `using namespace cpu_features;`\nstatic const X86Features features = GetX86Info().features;\nstatic const bool has_avx = CPU_FEATURES_COMPILED_X86_AVX || features.avx;\n\n// use has_avx.\n```\n\n`CPU_FEATURES_COMPILED_X86_AVX` is set to 1 if the compiler was instructed to\nuse AVX and 0 otherwise, combining compile time and runtime knowledge.\n\n### Rejecting poor hardware implementations based on microarchitecture\n\nOn x86, the first incarnation of a feature in a microarchitecture might not be\nthe most efficient (e.g. AVX on Sandy Bridge). We provide a function to retrieve\nthe underlying microarchitecture so you can decide whether to use it.\n\nBelow, `has_fast_avx` is set to 1 if the CPU supports the AVX instruction\nset\u0026mdash;but only if it's not Sandy Bridge.\n\n```c\n#include \u003cstdbool.h\u003e\n#include \"cpuinfo_x86.h\"\n\n// For C++, add `using namespace cpu_features;`\nstatic const X86Info info = GetX86Info();\nstatic const X86Microarchitecture uarch = GetX86Microarchitecture(\u0026info);\nstatic const bool has_fast_avx = info.features.avx \u0026\u0026 uarch != INTEL_SNB;\n\n// use has_fast_avx.\n```\n\nThis feature is currently available only for x86 microarchitectures.\n\n\u003ca name=\"usagesample\"\u003e\u003c/a\u003e\n### Running sample code\n\nBuilding `cpu_features` (check [quickstart](#quickstart) below) brings a small executable to test the library.\n\n```shell\n % ./build/list_cpu_features\narch            : x86\nbrand           :        Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz\nfamily          :   6 (0x06)\nmodel           :  45 (0x2D)\nstepping        :   7 (0x07)\nuarch           : INTEL_SNB\nflags           : aes,avx,cx16,smx,sse4_1,sse4_2,ssse3\n```\n\n```shell\n% ./build/list_cpu_features --json\n{\"arch\":\"x86\",\"brand\":\"       Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz\",\"family\":6,\"model\":45,\"stepping\":7,\"uarch\":\"INTEL_SNB\",\"flags\":[\"aes\",\"avx\",\"cx16\",\"smx\",\"sse4_1\",\"sse4_2\",\"ssse3\"]}\n```\n\n\u003ca name=\"support\"\u003e\u003c/a\u003e\n## What's supported\n\n|         | x86³ | AArch64 | ARM     | MIPS⁴   | POWER   | RISCV   | Loongarch | s390x   |\n|---------|:----:|:-------:|:-------:|:-------:|:-------:|:-------:|:---------:|:-------:|\n| Linux   | yes² | yes¹    | yes¹    | yes¹    | yes¹    | yes¹    | yes¹      | yes¹    |\n| FreeBSD | yes² | not yet | not yet | not yet | not yet | N/A     | not yet   | not yet |\n| MacOs   | yes² | yes⁵    | N/A     | N/A     | N/A     | N/A     | N/A       | N/A     |\n| Windows | yes² | not yet | not yet | N/A     | N/A     | N/A     | N/A       | N/A     |\n| Android | yes² | yes¹    | yes¹    | yes¹    | N/A     | N/A     | N/A       | N/A     |\n| iOS     | N/A  | not yet | not yet | N/A     | N/A     | N/A     | N/A       | N/A     |\n\n1.  **Features revealed from Linux.** We gather data from several sources\n    depending on availability:\n    +   from glibc's\n        [getauxval](https://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html)\n    +   by parsing `/proc/self/auxv`\n    +   by parsing `/proc/cpuinfo`\n2.  **Features revealed from CPU.** features are retrieved by using the `cpuid`\n    instruction.\n3.  **Microarchitecture detection.** On x86 some features are not always\n    implemented efficiently in hardware (e.g. AVX on Sandybridge). Exposing the\n    microarchitecture allows the client to reject particular microarchitectures.\n4.  All flavors of Mips are supported, little and big endian as well as 32/64\n    bits.\n5.  **Features revealed from sysctl.** features are retrieved by the `sysctl`\n    instruction.\n\n\u003ca name=\"ndk\"\u003e\u003c/a\u003e\n## Android NDK's drop in replacement\n\n[cpu_features](https://github.com/google/cpu_features) is now officially\nsupporting Android and offers a drop in replacement of for the NDK's [cpu-features.h](https://android.googlesource.com/platform/ndk/+/main/sources/android/cpufeatures/cpu-features.h)\n, see [ndk_compat](ndk_compat) folder for details.\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\n\nThe cpu_features library is licensed under the terms of the Apache license.\nSee [LICENSE](LICENSE) for more information.\n\n\u003ca name=\"cmake\"\u003e\u003c/a\u003e\n## Build with CMake\n\nPlease check the [CMake build instructions](cmake/README.md).\n\n\u003ca name=\"quickstart\"\u003e\u003c/a\u003e\n### Quickstart\n\n- Run `list_cpu_features`\n  ```sh\n  cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release\n  cmake --build build --config Release -j\n  ./build/list_cpu_features --json\n  ```\n\n  _Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and `XCode`.\n\n- run tests\n  ```sh\n  cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug\n  cmake --build build --config Debug -j\n  cmake --build build --config Debug --target test\n  ```\n\n  _Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and `--target RUN_TEST` for `XCode`.\n\n\n- install `cpu_features`\n  ```sh\n  cmake --build build --config Release --target install -v\n  ```\n\n  _Note_: Use `--target INSTALL` for `Visual Studio`.\n\n  _Note_: When using `Makefile` or `XCode` generator, you can use\n  [`DESTDIR`](https://www.gnu.org/software/make/manual/html_node/DESTDIR.html)\n  to install on a local repository.\u003cbr\u003e\n  e.g.\n  ```sh\n  cmake --build build --config Release --target install -v -- DESTDIR=install\n  ```\n\n\u003ca name=\"bindings\"\u003e\u003c/a\u003e\n## Community bindings\n\nLinks provided here are not affiliated with Google but are kindly provided by the OSS Community.\n\n - .Net\n   - https://github.com/toor1245/cpu_features.NET\n - Python\n   - https://github.com/Narasimha1997/py_cpu\n - Java\n   - https://github.com/aecsocket/cpu-features-java\n\n\n_Send PR to showcase your wrapper here_\n","funding_links":[],"categories":["C++","Utilities","Benchmarks","公用事业","Utilities ##"],"sub_categories":["YAML","Vim ###"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fcpu_features","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fcpu_features","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fcpu_features/lists"}