mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-03 10:16:14 +00:00
-BEGIN VERIFY SCRIPT- sed --in-place --regexp-extended \ 's;( 20[0-2][0-9])(-20[0-2][0-9])? The Bitcoin Core developers;\1-present The Bitcoin Core developers;g' \ $( git grep -l 'The Bitcoin Core developers' -- ':(exclude)COPYING' ':(exclude)src/ipc/libmultiprocess' ':(exclude)src/minisketch' ) -END VERIFY SCRIPT-
27 lines
845 B
C++
27 lines
845 B
C++
// Copyright (c) 2017-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_COMPAT_CPUID_H
|
|
#define BITCOIN_COMPAT_CPUID_H
|
|
|
|
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
|
|
#define HAVE_GETCPUID
|
|
|
|
#include <cpuid.h>
|
|
|
|
#include <cstdint>
|
|
|
|
// We can't use cpuid.h's __get_cpuid as it does not support subleafs.
|
|
void static inline GetCPUID(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uint32_t& c, uint32_t& d)
|
|
{
|
|
#ifdef __GNUC__
|
|
__cpuid_count(leaf, subleaf, a, b, c, d);
|
|
#else
|
|
__asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
|
|
#endif
|
|
}
|
|
|
|
#endif // defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
|
|
#endif // BITCOIN_COMPAT_CPUID_H
|