nil::crypto3::cpuid Class Referencefinal

#include <cpuid.hpp>

+ Collaboration diagram for nil::crypto3::cpuid:

Public Types

enum  CPUID_bits : uint64_t { CPUID_INITIALIZED_BIT = (1ULL << 63) }

Static Public Member Functions

static std::vector< cpuid::CPUID_bitsbit_from_string (const std::string &tok)
static size_t cache_line_size ()
static void clear_cpuid_bit (CPUID_bits bit)
static bool has_cpuid_bit (CPUID_bits elem)
static bool has_simd_32 ()
static void initialize ()
static bool is_big_endian ()
static bool is_little_endian ()
static std::string to_string ()

Detailed Description

A class handling runtime CPU feature detection. It is limited to just the features necessary to implement CPU specific code in library, rather than being a general purpose utility.

This class supports:

  • x86 features using CPUID. x86 is also the only processor with accurate cache line detection currently.
  • PowerPC AltiVec detection on Linux, NetBSD, OpenBSD, and Darwin
  • ARM NEON and crypto extensions detection. On Linux and Android systems which support getauxval, that is used to access CPU feature information. Otherwise a relatively portable but thread-unsafe mechanism involving executing probe functions which catching SIGILL signal is used.

Member Enumeration Documentation

◆ CPUID_bits


Member Function Documentation

◆ bit_from_string()

static std::vector<cpuid::CPUID_bits> nil::crypto3::cpuid::bit_from_string ( const std::string &  tok)

◆ cache_line_size()

static size_t nil::crypto3::cpuid::cache_line_size ( )

Return a best guess of the cache line size

◆ clear_cpuid_bit()

static void nil::crypto3::cpuid::clear_cpuid_bit ( CPUID_bits  bit)

◆ has_cpuid_bit()

static bool nil::crypto3::cpuid::has_cpuid_bit ( CPUID_bits  elem)

◆ has_simd_32()

static bool nil::crypto3::cpuid::has_simd_32 ( )

◆ initialize()

static void nil::crypto3::cpuid::initialize ( )

Probe the CPU and see what extensions are supported

◆ is_big_endian()

static bool nil::crypto3::cpuid::is_big_endian ( )

◆ is_little_endian()

static bool nil::crypto3::cpuid::is_little_endian ( )

◆ to_string()

static std::string nil::crypto3::cpuid::to_string ( )

Return a possibly empty string containing list of known CPU extensions. Each name will be seperated by a space, and the ordering will be arbitrary. This list only contains values that are useful for the library (for example FMA instructions are not checked).

Example outputs "sse2 ssse3 rdtsc", "neon arm_aes", "altivec"

The documentation for this class was generated from the following file: