Skip to content

Commit 8cfb520

Browse files
committed
[NFC] clang-format the code base
1 parent ec7d390 commit 8cfb520

11 files changed

+101
-97
lines changed

include/cpuinfo_loongarch.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CPU_FEATURES_START_CPP_NAMESPACE
2626

2727
typedef struct {
2828
// Base
29-
int CPUCFG : 1; // Instruction for Identify CPU Features
29+
int CPUCFG : 1; // Instruction for Identify CPU Features
3030

3131
// Extension
3232
int LAM : 1; // Extension for Atomic Memory Access Instructions
@@ -36,7 +36,8 @@ typedef struct {
3636
int LASX : 1; // Extension for Loongson Advanced SIMD eXtension
3737
int CRC32 : 1; // Extension for Cyclic Redundancy Check Instructions
3838
int COMPLEX : 1; // Extension for Complex Vector Operation Instructions
39-
int CRYPTO : 1; // Extension for Encryption And Decryption Vector Instructions
39+
int CRYPTO : 1; // Extension for Encryption And Decryption Vector
40+
// Instructions
4041
int LVZ : 1; // Extension for Virtualization
4142
int LBT_X86 : 1; // Extension for X86 Binary Translation Extension
4243
int LBT_ARM : 1; // Extension for ARM Binary Translation Extension
@@ -69,7 +70,7 @@ typedef enum {
6970

7071
LoongArchInfo GetLoongArchInfo(void);
7172
int GetLoongArchFeaturesEnumValue(const LoongArchFeatures* features,
72-
LoongArchFeaturesEnum value);
73+
LoongArchFeaturesEnum value);
7374
const char* GetLoongArchFeaturesEnumName(LoongArchFeaturesEnum);
7475

7576
CPU_FEATURES_END_CPP_NAMESPACE

include/cpuinfo_mips.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121
CPU_FEATURES_START_CPP_NAMESPACE
2222

2323
typedef struct {
24-
int msa : 1; // MIPS SIMD Architecture
25-
// https://www.mips.com/products/architectures/ase/simd/
26-
int eva : 1; // Enhanced Virtual Addressing
27-
// https://www.mips.com/products/architectures/mips64/
28-
int r6 : 1; // True if is release 6 of the processor.
29-
int mips16 : 1; // Compressed instructions
30-
int mdmx : 1; // MIPS Digital Media Extension
31-
int mips3d : 1; // 3D graphics acceleration
32-
// MIPS(r) Architecture for Programmers, Volume IV-c
33-
int smart : 1; // Smart-card cryptography
34-
// MIPS(r) Architecture for Programmers, Volume IV-d
35-
int dsp : 1; // Digital Signal Processing
36-
// MIPS(r) Architecture for Programmers, Volume IV-e
37-
// https://www.mips.com/products/architectures/ase/dsp/
24+
int msa : 1; // MIPS SIMD Architecture
25+
// https://www.mips.com/products/architectures/ase/simd/
26+
int eva : 1; // Enhanced Virtual Addressing
27+
// https://www.mips.com/products/architectures/mips64/
28+
int r6 : 1; // True if is release 6 of the processor.
29+
int mips16 : 1; // Compressed instructions
30+
int mdmx : 1; // MIPS Digital Media Extension
31+
int mips3d : 1; // 3D graphics acceleration
32+
// MIPS(r) Architecture for Programmers, Volume IV-c
33+
int smart : 1; // Smart-card cryptography
34+
// MIPS(r) Architecture for Programmers, Volume IV-d
35+
int dsp : 1; // Digital Signal Processing
36+
// MIPS(r) Architecture for Programmers, Volume IV-e
37+
// https://www.mips.com/products/architectures/ase/dsp/
3838

3939
// Make sure to update MipsFeaturesEnum below if you add a field here.
4040
} MipsFeatures;

include/cpuinfo_s390x.h

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@
2121
CPU_FEATURES_START_CPP_NAMESPACE
2222

2323
typedef struct {
24-
int esan3: 1; // instructions named N3, "backported" to esa-mode
25-
int zarch: 1; // z/Architecture mode active
26-
int stfle: 1; // store-facility-list-extended
27-
int msa: 1; // message-security assist
28-
int ldisp: 1; // long-displacement
29-
int eimm: 1; // extended-immediate
30-
int dfp: 1; // decimal floating point & perform floating point operation
31-
int edat: 1; // huge page support
32-
int etf3eh: 1; // extended-translation facility 3 enhancement
33-
int highgprs: 1; // 64-bit register support for 31-bit processes
34-
int te: 1; // transactional execution
35-
int vx: 1; // vector extension facility
36-
int vxd: 1; // vector-packed-decimal facility
37-
int vxe: 1; // vector-enhancement facility 1
38-
int gs: 1; // guarded-storage facility
39-
int vxe2: 1; // vector-enhancements facility 2
40-
int vxp: 1; // vector-packed-decimal-enhancement facility
41-
int sort: 1; // enhanced-sort facility
42-
int dflt: 1; // deflate-conversion facility
43-
int vxp2: 1; // vector-packed-decimal-enhancement facility 2
44-
int nnpa: 1; // neural network processing assist facility
45-
int pcimio: 1; // PCI mio facility
46-
int sie: 1; // virtualization support
24+
int esan3 : 1; // instructions named N3, "backported" to esa-mode
25+
int zarch : 1; // z/Architecture mode active
26+
int stfle : 1; // store-facility-list-extended
27+
int msa : 1; // message-security assist
28+
int ldisp : 1; // long-displacement
29+
int eimm : 1; // extended-immediate
30+
int dfp : 1; // decimal floating point & perform floating point operation
31+
int edat : 1; // huge page support
32+
int etf3eh : 1; // extended-translation facility 3 enhancement
33+
int highgprs : 1; // 64-bit register support for 31-bit processes
34+
int te : 1; // transactional execution
35+
int vx : 1; // vector extension facility
36+
int vxd : 1; // vector-packed-decimal facility
37+
int vxe : 1; // vector-enhancement facility 1
38+
int gs : 1; // guarded-storage facility
39+
int vxe2 : 1; // vector-enhancements facility 2
40+
int vxp : 1; // vector-packed-decimal-enhancement facility
41+
int sort : 1; // enhanced-sort facility
42+
int dflt : 1; // deflate-conversion facility
43+
int vxp2 : 1; // vector-packed-decimal-enhancement facility 2
44+
int nnpa : 1; // neural network processing assist facility
45+
int pcimio : 1; // PCI mio facility
46+
int sie : 1; // virtualization support
4747

4848
// Make sure to update S390XFeaturesEnum below if you add a field here.
4949
} S390XFeatures;
@@ -55,11 +55,11 @@ typedef struct {
5555
S390XInfo GetS390XInfo(void);
5656

5757
typedef struct {
58-
char platform[64]; // 0 terminated string
58+
char platform[64]; // 0 terminated string
5959
} S390XPlatformTypeStrings;
6060

6161
typedef struct {
62-
int num_processors; // -1 if N/A
62+
int num_processors; // -1 if N/A
6363
S390XPlatformTypeStrings type;
6464
} S390XPlatformStrings;
6565

@@ -95,7 +95,8 @@ typedef enum {
9595
S390X_LAST_,
9696
} S390XFeaturesEnum;
9797

98-
int GetS390XFeaturesEnumValue(const S390XFeatures* features, S390XFeaturesEnum value);
98+
int GetS390XFeaturesEnumValue(const S390XFeatures* features,
99+
S390XFeaturesEnum value);
99100

100101
const char* GetS390XFeaturesEnumName(S390XFeaturesEnum);
101102

include/cpuinfo_x86.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ typedef struct {
109109
int fs_rep_stosb : 1; // Fast short REP STOSB
110110
int fs_rep_cmpsb_scasb : 1; // Fast short REP CMPSB/SCASB
111111

112-
int lam: 1; // Intel Linear Address Mask
113-
int uai: 1; // AMD Upper Address Ignore
112+
int lam : 1; // Intel Linear Address Mask
113+
int uai : 1; // AMD Upper Address Ignore
114114
// Make sure to update X86FeaturesEnum below if you add a field here.
115115
} X86Features;
116116

src/impl_aarch64_macos_or_iphone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ Aarch64Info GetAarch64Info(void) {
6060
info.features.crc32 = GetDarwinSysCtlByName("hw.optional.armv8_crc32");
6161
info.features.atomics = GetDarwinSysCtlByName("hw.optional.arm.FEAT_LSE");
6262
info.features.fphp = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FP16");
63-
info.features.asimdhp = GetDarwinSysCtlByName("hw.optional.arm.AdvSIMD_HPFPCvt");
63+
info.features.asimdhp =
64+
GetDarwinSysCtlByName("hw.optional.arm.AdvSIMD_HPFPCvt");
6465
info.features.asimdrdm = GetDarwinSysCtlByName("hw.optional.arm.FEAT_RDM");
6566
info.features.jscvt = GetDarwinSysCtlByName("hw.optional.arm.FEAT_JSCVT");
6667
info.features.fcma = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FCMA");

src/impl_aarch64_windows.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ Aarch64Info GetAarch64Info(void) {
124124
info.features.atomics = GetWindowsIsProcessorFeaturePresent(
125125
PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE);
126126

127-
128127
bool is_crypto_available = GetWindowsIsProcessorFeaturePresent(
129128
PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
130129
info.features.aes = is_crypto_available;

src/impl_loongarch_linux.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@
2222
////////////////////////////////////////////////////////////////////////////////
2323
// Definitions for introspection.
2424
////////////////////////////////////////////////////////////////////////////////
25-
#define INTROSPECTION_TABLE \
26-
LINE(LOONGARCH_CPUCFG, CPUCFG, "cfg", HWCAP_LOONGARCH_CPUCFG, 0) \
27-
LINE(LOONGARCH_LAM, LAM, "lam", HWCAP_LOONGARCH_LAM, 0) \
28-
LINE(LOONGARCH_UAL, UAL, "ual", HWCAP_LOONGARCH_UAL, 0) \
29-
LINE(LOONGARCH_FPU, FPU, "fpu", HWCAP_LOONGARCH_FPU, 0) \
30-
LINE(LOONGARCH_LSX, LSX, "lsx", HWCAP_LOONGARCH_LSX, 0) \
31-
LINE(LOONGARCH_LASX, LASX, "lasx", HWCAP_LOONGARCH_LASX, 0) \
32-
LINE(LOONGARCH_CRC32, CRC32, "crc32", HWCAP_LOONGARCH_CRC32, 0) \
33-
LINE(LOONGARCH_COMPLEX, COMPLEX, "complex", HWCAP_LOONGARCH_COMPLEX, 0) \
34-
LINE(LOONGARCH_CRYPTO, CRYPTO, "crypto", HWCAP_LOONGARCH_CRYPTO, 0) \
35-
LINE(LOONGARCH_LVZ, LVZ, "lvz", HWCAP_LOONGARCH_LVZ, 0) \
36-
LINE(LOONGARCH_LBT_X86, LBT_X86, "lbt_x86", HWCAP_LOONGARCH_LBT_X86, 0) \
37-
LINE(LOONGARCH_LBT_ARM, LBT_ARM, "lbt_arm", HWCAP_LOONGARCH_LBT_ARM, 0) \
25+
#define INTROSPECTION_TABLE \
26+
LINE(LOONGARCH_CPUCFG, CPUCFG, "cfg", HWCAP_LOONGARCH_CPUCFG, 0) \
27+
LINE(LOONGARCH_LAM, LAM, "lam", HWCAP_LOONGARCH_LAM, 0) \
28+
LINE(LOONGARCH_UAL, UAL, "ual", HWCAP_LOONGARCH_UAL, 0) \
29+
LINE(LOONGARCH_FPU, FPU, "fpu", HWCAP_LOONGARCH_FPU, 0) \
30+
LINE(LOONGARCH_LSX, LSX, "lsx", HWCAP_LOONGARCH_LSX, 0) \
31+
LINE(LOONGARCH_LASX, LASX, "lasx", HWCAP_LOONGARCH_LASX, 0) \
32+
LINE(LOONGARCH_CRC32, CRC32, "crc32", HWCAP_LOONGARCH_CRC32, 0) \
33+
LINE(LOONGARCH_COMPLEX, COMPLEX, "complex", HWCAP_LOONGARCH_COMPLEX, 0) \
34+
LINE(LOONGARCH_CRYPTO, CRYPTO, "crypto", HWCAP_LOONGARCH_CRYPTO, 0) \
35+
LINE(LOONGARCH_LVZ, LVZ, "lvz", HWCAP_LOONGARCH_LVZ, 0) \
36+
LINE(LOONGARCH_LBT_X86, LBT_X86, "lbt_x86", HWCAP_LOONGARCH_LBT_X86, 0) \
37+
LINE(LOONGARCH_LBT_ARM, LBT_ARM, "lbt_arm", HWCAP_LOONGARCH_LBT_ARM, 0) \
3838
LINE(LOONGARCH_LBT_MIPS, LBT_MIPS, "lbt_mips", HWCAP_LOONGARCH_LBT_MIPS, 0) \
3939
LINE(LOONGARCH_PTW, PTW, "ptw", HWCAP_LOONGARCH_PTW, 0)
4040
#define INTROSPECTION_PREFIX LoongArch
@@ -53,7 +53,8 @@
5353

5454
static const LoongArchInfo kEmptyLoongArchInfo;
5555

56-
static bool HandleLoongArchLine(const LineResult result, LoongArchInfo* const info) {
56+
static bool HandleLoongArchLine(const LineResult result,
57+
LoongArchInfo* const info) {
5758
StringView line = result.line;
5859
StringView key, value;
5960
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {

src/impl_ppc_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
LINE(PPC_SCV, scv, "scv", 0, PPC_FEATURE2_SCV) \
7070
LINE(PPC_HTM_NO_SUSPEND, htm_no_suspend, "htm-no-suspend", 0, \
7171
PPC_FEATURE2_HTM_NO_SUSPEND)
72-
#undef PPC // Remove conflict with compiler generated preprocessor
72+
#undef PPC // Remove conflict with compiler generated preprocessor
7373
#define INTROSPECTION_PREFIX PPC
7474
#define INTROSPECTION_ENUM_PREFIX PPC
7575
#include "define_introspection_and_hwcaps.inl"

src/impl_s390x_linux.c

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@
2222
////////////////////////////////////////////////////////////////////////////////
2323
// Definitions for introspection.
2424
////////////////////////////////////////////////////////////////////////////////
25-
#define INTROSPECTION_TABLE \
26-
LINE(S390_ESAN3, esan3, "esan3", HWCAP_S390_ESAN3, 0) \
27-
LINE(S390_ZARCH, zarch, "zarch", HWCAP_S390_ZARCH, 0) \
28-
LINE(S390_STFLE, stfle, "stfle", HWCAP_S390_STFLE, 0) \
29-
LINE(S390_MSA, msa, "msa", HWCAP_S390_MSA, 0) \
30-
LINE(S390_LDISP, ldisp, "ldisp", HWCAP_S390_LDISP, 0) \
31-
LINE(S390_EIMM, eimm, "eimm", HWCAP_S390_EIMM, 0) \
32-
LINE(S390_DFP, dfp, "dfp", HWCAP_S390_DFP, 0) \
33-
LINE(S390_EDAT, edat, "edat", HWCAP_S390_HPAGE, 0) \
34-
LINE(S390_ETF3EH, etf3eh, "etf3eh", HWCAP_S390_ETF3EH, 0) \
35-
LINE(S390_HIGHGPRS, highgprs, "highgprs", HWCAP_S390_HIGH_GPRS, 0) \
36-
LINE(S390_TE, te, "te", HWCAP_S390_TE, 0) \
37-
LINE(S390_VX, vx, "vx", HWCAP_S390_VXRS, 0) \
38-
LINE(S390_VXD, vxd, "vxd", HWCAP_S390_VXRS_BCD, 0) \
39-
LINE(S390_VXE, vxe, "vxe", HWCAP_S390_VXRS_EXT, 0) \
40-
LINE(S390_GS, gs, "gs", HWCAP_S390_GS, 0) \
41-
LINE(S390_VXE2, vxe2, "vxe2", HWCAP_S390_VXRS_EXT2, 0) \
42-
LINE(S390_VXP, vxp, "vxp", HWCAP_S390_VXRS_PDE, 0) \
43-
LINE(S390_SORT, sort, "sort", HWCAP_S390_SORT, 0) \
44-
LINE(S390_DFLT, dflt, "dflt", HWCAP_S390_DFLT, 0) \
45-
LINE(S390_VXP2, vxp2, "vxp2", HWCAP_S390_VXRS_PDE2, 0) \
46-
LINE(S390_NNPA, nnpa, "nnpa", HWCAP_S390_NNPA, 0) \
47-
LINE(S390_PCIMIO, pcimio, "pcimio", HWCAP_S390_PCI_MIO, 0) \
25+
#define INTROSPECTION_TABLE \
26+
LINE(S390_ESAN3, esan3, "esan3", HWCAP_S390_ESAN3, 0) \
27+
LINE(S390_ZARCH, zarch, "zarch", HWCAP_S390_ZARCH, 0) \
28+
LINE(S390_STFLE, stfle, "stfle", HWCAP_S390_STFLE, 0) \
29+
LINE(S390_MSA, msa, "msa", HWCAP_S390_MSA, 0) \
30+
LINE(S390_LDISP, ldisp, "ldisp", HWCAP_S390_LDISP, 0) \
31+
LINE(S390_EIMM, eimm, "eimm", HWCAP_S390_EIMM, 0) \
32+
LINE(S390_DFP, dfp, "dfp", HWCAP_S390_DFP, 0) \
33+
LINE(S390_EDAT, edat, "edat", HWCAP_S390_HPAGE, 0) \
34+
LINE(S390_ETF3EH, etf3eh, "etf3eh", HWCAP_S390_ETF3EH, 0) \
35+
LINE(S390_HIGHGPRS, highgprs, "highgprs", HWCAP_S390_HIGH_GPRS, 0) \
36+
LINE(S390_TE, te, "te", HWCAP_S390_TE, 0) \
37+
LINE(S390_VX, vx, "vx", HWCAP_S390_VXRS, 0) \
38+
LINE(S390_VXD, vxd, "vxd", HWCAP_S390_VXRS_BCD, 0) \
39+
LINE(S390_VXE, vxe, "vxe", HWCAP_S390_VXRS_EXT, 0) \
40+
LINE(S390_GS, gs, "gs", HWCAP_S390_GS, 0) \
41+
LINE(S390_VXE2, vxe2, "vxe2", HWCAP_S390_VXRS_EXT2, 0) \
42+
LINE(S390_VXP, vxp, "vxp", HWCAP_S390_VXRS_PDE, 0) \
43+
LINE(S390_SORT, sort, "sort", HWCAP_S390_SORT, 0) \
44+
LINE(S390_DFLT, dflt, "dflt", HWCAP_S390_DFLT, 0) \
45+
LINE(S390_VXP2, vxp2, "vxp2", HWCAP_S390_VXRS_PDE2, 0) \
46+
LINE(S390_NNPA, nnpa, "nnpa", HWCAP_S390_NNPA, 0) \
47+
LINE(S390_PCIMIO, pcimio, "pcimio", HWCAP_S390_PCI_MIO, 0) \
4848
LINE(S390_SIE, sie, "sie", HWCAP_S390_SIE, 0)
4949
#define INTROSPECTION_PREFIX S390X
5050
#define INTROSPECTION_ENUM_PREFIX S390X
@@ -63,12 +63,13 @@
6363
#include "internal/string_view.h"
6464

6565
static bool HandleS390XLine(const LineResult result,
66-
S390XPlatformStrings* const strings) {
66+
S390XPlatformStrings* const strings) {
6767
StringView line = result.line;
6868
StringView key, value;
6969
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
7070
if (CpuFeatures_StringView_IsEquals(key, str("# processors"))) {
71-
strings->num_processors = CpuFeatures_StringView_ParsePositiveNumber(value);
71+
strings->num_processors =
72+
CpuFeatures_StringView_ParsePositiveNumber(value);
7273
}
7374
}
7475
return !result.eof;

src/impl_x86_windows.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ static void DetectFeaturesFromOs(X86Info* info, X86Features* features) {
5050
features->sse4_2 =
5151
GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
5252

53-
// do not bother checking PF_AVX*
54-
// cause AVX enabled processor will have XCR0 be exposed and this function will be skipped at all
53+
// Do not bother checking PF_AVX* : AVX enabled processor will have their XCR0
54+
// register exposed and this function will be skipped altogether.
5555
}
5656

5757
#endif // CPU_FEATURES_OS_WINDOWS

0 commit comments

Comments
 (0)