[flac-dev] How to check for 64-bit CPU?

Thomas Zander thomas.e.zander at googlemail.com
Tue Dec 29 05:18:14 PST 2015


On 29 December 2015 at 13:33, Rafaël Carré <funman at videolan.org> wrote:
> On 12/28/2015 08:35 PM, lvqcl wrote:
>> In stream_encoder.c there's the following code:
>>
>>   #if defined FLAC__CPU_X86_64 /* and other 64-bit arch, too */
>>       if(mean <= 0x80000000/512) { /* 512: more or less optimal for both 16- and 24-bit input */
>>   #else
>>       if(mean <= 0x80000000/8) { /* 32-bit arch: use 32-bit math if possible */
>>   #endif
>>
>> A) How to properly check for 64-bit architectures?
>> I can check for "defined FLAC__CPU_X86_64" or "defined _WIN64".
>> Is it possible to use SIZEOF_VOIDP? such as "#if SIZEOF_VOIDP == 8" ?
>
> That would need a special case for Linux x32 which is x86_64 with 32
> bits pointers

... and this probably won't be the last time we'd need to handle special cases.
Do we really need to handle this at all? Entangling CPU-arch-dependent
#ifdefs with input sample size (see "tuned for N-bit input" a few
lines below" seems weird.
IMHO finding the rice parameter should be independent of the cpu arch
unless there is a spectacular benefit by distinguishing.

Best regards
Riggs


More information about the flac-dev mailing list