mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-18 16:49:58 +00:00
add uncommitted files
This commit is contained in:
parent
91e45d9a4a
commit
7e60069968
34
libi2pd/CPU.cpp
Normal file
34
libi2pd/CPU.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "CPU.h"
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
#include "Log.h"
|
||||
namespace i2p
|
||||
{
|
||||
namespace cpu
|
||||
{
|
||||
bool aesni = false;
|
||||
bool avx = false;
|
||||
|
||||
void Detect()
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
int info[4];
|
||||
__cpuid(0, info[0], info[1], info[2], info[3]);
|
||||
if (info[0] >= 0x00000001) {
|
||||
__cpuid(0x00000001, info[0], info[1], info[2], info[3]);
|
||||
aesni = info[2] & bit_AES; // AESNI
|
||||
avx = info[2] & bit_AVX; // AVX
|
||||
}
|
||||
#endif
|
||||
if(aesni)
|
||||
{
|
||||
LogPrint(eLogInfo, "AESNI enabled");
|
||||
}
|
||||
if(avx)
|
||||
{
|
||||
LogPrint(eLogInfo, "AVX enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
libi2pd/CPU.h
Normal file
15
libi2pd/CPU.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef LIBI2PD_CPU_H
|
||||
#define LIBI2PD_CPU_H
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace cpu
|
||||
{
|
||||
extern bool aesni;
|
||||
extern bool avx;
|
||||
|
||||
void Detect();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user