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

Thomas Zander thomas.e.zander at googlemail.com
Tue Dec 29 12:03:39 PST 2015


On 29 December 2015 at 17:16, lvqcl <lvqcl.mail at gmail.com> wrote:

> I agree that it's a good idea to test the speed of encoding.
> Maybe different code for 32-bit and 64-bit architectures
> is over-optimization.

I completely agree. With today's complicated CPUs it would be
extremely hard if not impossible to formulate something like
#if 64-bit-CPU
  //C code that is guaranteed to run faster on any 64 bit CPU of any
given arch than its 32 bit counterpart
  //i.e. 64 bit x86 faster than 32 bit x86; 64 bit ARM faster than 32
bit ARM; ppc, sparc, mips, ... for every chip
#else
  //version that it always faster on 32 bit
#endif
Maybe it's time for profile guided optimisation :-)
Seriously though, we should keep the number of
compile-time-#define'able code paths that are supposed to calculate
the same result manageable. The Rice parameter estimation /
calculation in stream_encoder.c contains surprisingly many #ifdefs.

Riggs


More information about the flac-dev mailing list