mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Remove union data from FLAC__CPUInfo.
Before this patch it was possible to set or get data.ia32.sse3 value from x86-64 code, etc which is a potential source of errors. Patch-from: lvqcl <lvqcl.mail@gmail.com>
This commit is contained in:
@@ -46,6 +46,7 @@ typedef enum {
|
||||
FLAC__CPUINFO_TYPE_UNKNOWN
|
||||
} FLAC__CPUInfo_Type;
|
||||
|
||||
#if defined FLAC__CPU_IA32
|
||||
typedef struct {
|
||||
FLAC__bool cpuid;
|
||||
FLAC__bool bswap;
|
||||
@@ -62,27 +63,30 @@ typedef struct {
|
||||
FLAC__bool ext3dnow;
|
||||
FLAC__bool extmmx;
|
||||
} FLAC__CPUInfo_IA32;
|
||||
|
||||
#elif defined FLAC__CPU_X86_64
|
||||
typedef struct {
|
||||
FLAC__bool sse3;
|
||||
FLAC__bool ssse3;
|
||||
FLAC__bool sse41;
|
||||
FLAC__bool sse42;
|
||||
} FLAC__CPUInfo_x86_64;
|
||||
|
||||
#elif defined FLAC__CPU_PPC
|
||||
typedef struct {
|
||||
FLAC__bool altivec;
|
||||
FLAC__bool ppc64;
|
||||
} FLAC__CPUInfo_PPC;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool use_asm;
|
||||
FLAC__CPUInfo_Type type;
|
||||
union {
|
||||
FLAC__CPUInfo_IA32 ia32;
|
||||
FLAC__CPUInfo_x86_64 x86_64;
|
||||
FLAC__CPUInfo_PPC ppc;
|
||||
} data;
|
||||
#if defined FLAC__CPU_IA32
|
||||
FLAC__CPUInfo_IA32 ia32;
|
||||
#elif defined FLAC__CPU_X86_64
|
||||
FLAC__CPUInfo_x86_64 x86_64;
|
||||
#elif defined FLAC__CPU_PPC
|
||||
FLAC__CPUInfo_PPC ppc;
|
||||
#endif
|
||||
} FLAC__CPUInfo;
|
||||
|
||||
void FLAC__cpu_info(FLAC__CPUInfo *info);
|
||||
@@ -95,7 +99,7 @@ void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flag
|
||||
FLAC__uint32 FLAC__cpu_info_extended_amd_asm_ia32(void);
|
||||
#endif
|
||||
|
||||
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X86INTRIN
|
||||
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X86INTRIN
|
||||
void FLAC__cpu_info_x86(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user