Botan
3.11.0
Crypto and TLS for C&
src
lib
utils
cpuid
cpuid_wasm
cpuid_features.h
Go to the documentation of this file.
1
/**
2
* (C) 2025 Jack Lloyd
3
* (C) 2025 polarnis
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_CPUID_FEATURES_H_
9
#define BOTAN_CPUID_FEATURES_H_
10
11
#include <botan/api.h>
12
#include <cstdint>
13
#include <optional>
14
#include <string>
15
#include <string_view>
16
17
namespace
Botan
{
18
19
class
BOTAN_TEST_API
CPUFeature
{
20
public
:
21
enum
Bit
: uint32_t
/* NOLINT(*-use-enum-class) */
{
22
SIMD128
= (1U << 0),
23
24
SIMD_4X32
=
SIMD128
,
25
SIMD_2X64
=
SIMD128
,
26
};
27
28
CPUFeature
(
Bit
b) : m_bit(b) {}
// NOLINT(*-explicit-conversions)
29
30
uint32_t
as_u32
()
const
{
return
static_cast<
uint32_t
>
(m_bit); }
31
32
std::string
to_string
()
const
;
33
34
static
std::optional<CPUFeature>
from_string
(std::string_view s);
35
36
private
:
37
Bit
m_bit;
38
};
39
40
}
// namespace Botan
41
42
#endif
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition
api.h:41
Botan::CPUFeature
Definition
cpuid.h:24
Botan::CPUFeature::as_u32
uint32_t as_u32() const
Definition
cpuid_features.h:30
Botan::CPUFeature::CPUFeature
CPUFeature(Bit b)
Definition
cpuid_features.h:28
Botan::CPUFeature::Bit
Bit
Definition
cpuid.h:26
Botan::CPUFeature::SIMD128
@ SIMD128
Definition
cpuid_features.h:22
Botan::CPUFeature::SIMD_2X64
@ SIMD_2X64
Definition
cpuid_features.h:25
Botan::CPUFeature::SIMD_4X32
@ SIMD_4X32
Definition
cpuid_features.h:32
Botan::CPUFeature::from_string
static std::optional< CPUFeature > from_string(std::string_view s)
Botan::CPUFeature::to_string
std::string to_string() const
Botan
Definition
alg_id.cpp:13
Generated by
1.15.0