[flac-dev] PATCH for cpu.c

Oliver Stöneberg oliverst at online.de
Sun Mar 23 14:31:07 PDT 2014


> Oliver Stöneberg wrote:
> 
> >> Unfortunately it breaks x86_64 build (where FLAC__CPU_X86_64 is defined, and
> >> FLAC__CPU_IA32 isn't). Maybe it's simpler to turn them into #defines such as
> >>
> >>      #define FLAC__CPUINFO_IA32_CPUID_CMOV 0x00008000U
> >>      #define FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW 0x80000000U
> >>
> >> and so on?
> >
> > Maybe - I usually don't try to change the basics of code, but try to
> > fix the errors properly.
> > I overlooked that code since it didn't exist in 1.2.1 and 1.3.0 and
> > we never set the CPU defines before for MAME/MESS (will look into
> > that).
> 
> 
> Another possible solution is to dumplicate the definitions like this:
> 
> 
> #if defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && (defined FLAC__HAS_NASM || defined FLAC__HAS_X86INTRIN)
> /* these are flags in EDX of CPUID AX=00000001 */
> static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000;
> /* these are flags in ECX of CPUID AX=00000001 */
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE41 = 0x00080000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE42 = 0x00100000;
> #if defined FLAC__HAS_NASM && defined FLAC__USE_3DNOW
> /* these are flags in EDX of CPUID AX=80000001 */
> static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW = 0x80000000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW = 0x40000000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000;
> #endif
> #endif
> #if defined FLAC__CPU_X86_64 && !defined FLAC__NO_ASM && defined FLAC__HAS_X86INTRIN
> /* these are flags in ECX of CPUID AX=00000001 */
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE41 = 0x00080000;
> static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE42 = 0x00100000;
> #endif

I'd rather make it a split #ifdef clusterf... with single instances 
of each constant instead...


More information about the flac-dev mailing list