2010/2/4 Hicham Mouline <hicham@mouline.org>
So Roman, what do you think of my POWER2 implementation?

It is very slow (to preprocess) in an actual example I have.
Can anyone see a faster implementation?

I'd use something like this:

#define POWER_2_0 1
#define POWER_2_1 2
#define POWER_2_2 4
#define POWER_2_3 8
#define POWER_2_4 16
#define POWER_2_5 32
#define POWER_2_6 64
#define POWER_2_7 128
#define POWER_2_8 256

#define POWER_2(n) BOOST_PP_CAT(POWER_2_, n)

It's obviously fast and obviously correct.

Roman Perepelitsa.