1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-28 07:23:37 +02:00

Use CPU_FEATURES_ prefix for namespace macros.

This commit is contained in:
Guillaume Chatelet 2018-02-12 16:15:15 +01:00
parent 8bace7000c
commit e419573d10
12 changed files with 26 additions and 26 deletions

View File

@ -78,15 +78,15 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) #if defined(__cplusplus)
#define START_CPP_NAMESPACE \ #define CPU_FEATURES_START_CPP_NAMESPACE \
namespace cpu_features { \ namespace cpu_features { \
extern "C" { extern "C" {
#define END_CPP_NAMESPACE \ #define CPU_FEATURES_END_CPP_NAMESPACE \
} \ } \
} }
#else #else
#define START_CPP_NAMESPACE #define CPU_FEATURES_START_CPP_NAMESPACE
#define END_CPP_NAMESPACE #define CPU_FEATURES_END_CPP_NAMESPACE
#endif #endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -17,7 +17,7 @@
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
typedef struct { typedef struct {
int fp : 1; // Floating-point. int fp : 1; // Floating-point.
@ -60,6 +60,6 @@ int GetAarch64FeaturesEnumValue(const Aarch64Features* features,
const char* GetAarch64FeaturesEnumName(Aarch64FeaturesEnum); const char* GetAarch64FeaturesEnumName(Aarch64FeaturesEnum);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_ #endif // CPU_FEATURES_INCLUDE_CPUINFO_AARCH64_H_

View File

@ -17,7 +17,7 @@
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
typedef struct { typedef struct {
int vfp : 1; // Vector Floating Point. int vfp : 1; // Vector Floating Point.
@ -75,6 +75,6 @@ int GetArmFeaturesEnumValue(const ArmFeatures* features, ArmFeaturesEnum value);
const char* GetArmFeaturesEnumName(ArmFeaturesEnum); const char* GetArmFeaturesEnumName(ArmFeaturesEnum);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_CPUINFO_ARM_H_ #endif // CPU_FEATURES_INCLUDE_CPUINFO_ARM_H_

View File

@ -17,7 +17,7 @@
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
typedef struct { typedef struct {
int msa : 1; // MIPS SIMD Architecture int msa : 1; // MIPS SIMD Architecture
@ -48,6 +48,6 @@ int GetMipsFeaturesEnumValue(const MipsFeatures* features,
const char* GetMipsFeaturesEnumName(MipsFeaturesEnum); const char* GetMipsFeaturesEnumName(MipsFeaturesEnum);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_ #endif // CPU_FEATURES_INCLUDE_CPUINFO_MIPS_H_

View File

@ -17,7 +17,7 @@
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
// See https://en.wikipedia.org/wiki/CPUID for a list of x86 cpu features. // See https://en.wikipedia.org/wiki/CPUID for a list of x86 cpu features.
typedef struct { typedef struct {
@ -142,6 +142,6 @@ const char* GetX86FeaturesEnumName(X86FeaturesEnum);
const char* GetX86MicroarchitectureName(X86Microarchitecture); const char* GetX86MicroarchitectureName(X86Microarchitecture);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_CPUINFO_X86_H_ #endif // CPU_FEATURES_INCLUDE_CPUINFO_X86_H_

View File

@ -20,7 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
inline static bool IsBitSet(uint32_t reg, uint32_t bit) { inline static bool IsBitSet(uint32_t reg, uint32_t bit) {
return (reg >> bit) & 0x1; return (reg >> bit) & 0x1;
@ -34,6 +34,6 @@ inline static uint32_t ExtractBitRange(uint32_t reg, uint32_t msb,
return (reg >> lsb) & mask; return (reg >> lsb) & mask;
} }
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_BIT_UTILS_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_BIT_UTILS_H_

View File

@ -19,7 +19,7 @@
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
// A struct to hold the result of a call to cpuid. // A struct to hold the result of a call to cpuid.
typedef struct { typedef struct {
@ -32,6 +32,6 @@ Leaf CpuId(uint32_t leaf_id);
// Returns the eax value of the XCR0 register. // Returns the eax value of the XCR0 register.
uint32_t GetXCR0Eax(void); uint32_t GetXCR0Eax(void);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_CPUID_X86_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_CPUID_X86_H_

View File

@ -21,7 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
// Same as linux "open(filename, O_RDONLY)", retries automatically on EINTR. // Same as linux "open(filename, O_RDONLY)", retries automatically on EINTR.
int OpenFile(const char* filename); int OpenFile(const char* filename);
@ -33,6 +33,6 @@ int ReadFile(int file_descriptor, void* buffer, size_t buffer_size);
// Same as linux "close(file_descriptor)". // Same as linux "close(file_descriptor)".
void CloseFile(int file_descriptor); void CloseFile(int file_descriptor);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_FILESYSTEM_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_FILESYSTEM_H_

View File

@ -20,7 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
// To avoid depending on the linux kernel we reproduce the architecture specific // To avoid depending on the linux kernel we reproduce the architecture specific
// constants here. // constants here.
@ -68,6 +68,6 @@ typedef struct {
HardwareCapabilities GetHardwareCapabilities(void); HardwareCapabilities GetHardwareCapabilities(void);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_HWCAPS_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_HWCAPS_H_

View File

@ -24,7 +24,7 @@
#include "internal/hwcaps.h" #include "internal/hwcaps.h"
#include "internal/string_view.h" #include "internal/string_view.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
// Use the following macro to declare setter functions to be used in // Use the following macro to declare setter functions to be used in
// CapabilityConfig. // CapabilityConfig.
@ -54,5 +54,5 @@ void OverrideFromHwCaps(const size_t configs_size,
const HardwareCapabilities hwcaps, const HardwareCapabilities hwcaps,
void* const features); void* const features);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_LINUX_FEATURES_AGGREGATOR_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_LINUX_FEATURES_AGGREGATOR_H_

View File

@ -22,7 +22,7 @@
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
#include "internal/string_view.h" #include "internal/string_view.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
typedef struct { typedef struct {
char buffer[STACK_LINE_READER_BUFFER_SIZE]; char buffer[STACK_LINE_READER_BUFFER_SIZE];
@ -44,6 +44,6 @@ typedef struct {
// Reads the file pointed to by fd and tries to read a full line. // Reads the file pointed to by fd and tries to read a full line.
LineResult StackLineReader_NextLine(StackLineReader* reader); LineResult StackLineReader_NextLine(StackLineReader* reader);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_STACK_LINE_READER_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_STACK_LINE_READER_H_

View File

@ -21,7 +21,7 @@
#include <string.h> #include <string.h>
#include "cpu_features_macros.h" #include "cpu_features_macros.h"
START_CPP_NAMESPACE CPU_FEATURES_START_CPP_NAMESPACE
typedef struct { typedef struct {
const char* ptr; const char* ptr;
@ -96,6 +96,6 @@ bool HasWord(const StringView line, const char* const word);
bool GetAttributeKeyValue(const StringView line, StringView* key, bool GetAttributeKeyValue(const StringView line, StringView* key,
StringView* value); StringView* value);
END_CPP_NAMESPACE CPU_FEATURES_END_CPP_NAMESPACE
#endif // CPU_FEATURES_INCLUDE_INTERNAL_STRING_VIEW_H_ #endif // CPU_FEATURES_INCLUDE_INTERNAL_STRING_VIEW_H_