Crypto++  5.6.4
Free C++ class library of cryptographic schemes
Macros | Functions
cpu.h File Reference

Functions for CPU features and intrinsics. More...

Go to the source code of this file.

Functions

bool HasMMX ()
 Determines MMX availability. More...
 
bool HasISSE ()
 Determines SSE availability. More...
 
bool HasSSE2 ()
 Determines SSE2 availability. More...
 
bool HasSSSE3 ()
 Determines SSSE3 availability. More...
 
bool HasSSE4 ()
 Determines SSE4 availability. More...
 
bool HasAESNI ()
 Determines AES-NI availability. More...
 
bool HasCLMUL ()
 Determines Carryless Multiply availability. More...
 
bool IsP4 ()
 Determines if the CPU is an Intel P4. More...
 
bool HasRDRAND ()
 Determines RDRAND availability. More...
 
bool HasRDSEED ()
 Determines RDSEED availability. More...
 
bool HasPadlockRNG ()
 Determines Padlock RNG availability. More...
 
bool HasPadlockACE ()
 Determines Padlock ACE availability. More...
 
bool HasPadlockACE2 ()
 Determines Padlock ACE2 availability. More...
 
bool HasPadlockPHE ()
 Determines Padlock PHE availability. More...
 
bool HasPadlockPMM ()
 Determines Padlock PMM availability. More...
 
int GetCacheLineSize ()
 Provides the cache line size. More...
 

Detailed Description

Functions for CPU features and intrinsics.

The functions are used in X86/X32/X64 and NEON code paths

Definition in file cpu.h.

Function Documentation

◆ HasMMX()

bool HasMMX ( )
inline

Determines MMX availability.

Returns
true if MMX is determined to be available, false otherwise

MMX, SSE and SSE2 are core processor features for x86_64, and the function always returns true for the platform.

Definition at line 206 of file cpu.h.

◆ HasISSE()

bool HasISSE ( )
inline

Determines SSE availability.

Returns
true if SSE is determined to be available, false otherwise

MMX, SSE and SSE2 are core processor features for x86_64, and the function always returns true for the platform.

Definition at line 221 of file cpu.h.

◆ HasSSE2()

bool HasSSE2 ( )
inline

Determines SSE2 availability.

Returns
true if SSE2 is determined to be available, false otherwise

MMX, SSE and SSE2 are core processor features for x86_64, and the function always returns true for the platform.

Definition at line 236 of file cpu.h.

◆ HasSSSE3()

bool HasSSSE3 ( )
inline

Determines SSSE3 availability.

Returns
true if SSSE3 is determined to be available, false otherwise

HasSSSE3() is a runtime check performed using CPUID

Note
Some Clang compilers incorrectly omit SSSE3 even though its native to the processor.

Definition at line 251 of file cpu.h.

◆ HasSSE4()

bool HasSSE4 ( )
inline

Determines SSE4 availability.

Returns
true if SSE4.1 and SSE4.2 are determined to be available, false otherwise

HasSSE4() is a runtime check performed using CPUID which requires both SSE4.1 and SSE4.2

Definition at line 261 of file cpu.h.

◆ HasAESNI()

bool HasAESNI ( )
inline

Determines AES-NI availability.

Returns
true if AES-NI is determined to be available, false otherwise

HasAESNI() is a runtime check performed using CPUID

Definition at line 271 of file cpu.h.

◆ HasCLMUL()

bool HasCLMUL ( )
inline

Determines Carryless Multiply availability.

Returns
true if pclmulqdq is determined to be available, false otherwise

HasCLMUL() is a runtime check performed using CPUID

Definition at line 281 of file cpu.h.

◆ IsP4()

bool IsP4 ( )
inline

Determines if the CPU is an Intel P4.

Returns
true if the CPU is a P4, false otherwise

IsP4() is a runtime check performed using CPUID

Definition at line 291 of file cpu.h.

◆ HasRDRAND()

bool HasRDRAND ( )
inline

Determines RDRAND availability.

Returns
true if RDRAND is determined to be available, false otherwise

HasRDRAND() is a runtime check performed using CPUID

Definition at line 301 of file cpu.h.

◆ HasRDSEED()

bool HasRDSEED ( )
inline

Determines RDSEED availability.

Returns
true if RDSEED is determined to be available, false otherwise

HasRDSEED() is a runtime check performed using CPUID

Definition at line 311 of file cpu.h.

◆ HasPadlockRNG()

bool HasPadlockRNG ( )
inline

Determines Padlock RNG availability.

Returns
true if VIA Padlock RNG is determined to be available, false otherwise

HasPadlockRNG() is a runtime check performed using CPUID

Definition at line 321 of file cpu.h.

◆ HasPadlockACE()

bool HasPadlockACE ( )
inline

Determines Padlock ACE availability.

Returns
true if VIA Padlock ACE is determined to be available, false otherwise

HasPadlockACE() is a runtime check performed using CPUID

Definition at line 331 of file cpu.h.

◆ HasPadlockACE2()

bool HasPadlockACE2 ( )
inline

Determines Padlock ACE2 availability.

Returns
true if VIA Padlock ACE2 is determined to be available, false otherwise

HasPadlockACE2() is a runtime check performed using CPUID

Definition at line 341 of file cpu.h.

◆ HasPadlockPHE()

bool HasPadlockPHE ( )
inline

Determines Padlock PHE availability.

Returns
true if VIA Padlock PHE is determined to be available, false otherwise

HasPadlockPHE() is a runtime check performed using CPUID

Definition at line 351 of file cpu.h.

◆ HasPadlockPMM()

bool HasPadlockPMM ( )
inline

Determines Padlock PMM availability.

Returns
true if VIA Padlock PMM is determined to be available, false otherwise

HasPadlockPMM() is a runtime check performed using CPUID

Definition at line 361 of file cpu.h.

◆ GetCacheLineSize()

int GetCacheLineSize ( )
inline

Provides the cache line size.

Returns
lower bound on the size of a cache line in bytes, if available

GetCacheLineSize() returns the lower bound on the size of a cache line, if it is available. If the value is not available at runtime, then 32 is returned for a 32-bit processor and 64 is returned for a 64-bit processor.

x86/x32/x64 uses CPUID to determine the value and its usually accurate. The ARM processor equivalent is a privileged instruction, so a compile time value is returned.

Definition at line 375 of file cpu.h.