Preprocessor/compiler calculations/arithmetic

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Preprocessor/compiler calculations/arithmetic

Post by lilltroll »

Can I use the pre-prossor or a optimization level of the compiler to calculate things when compiling to avoid run-time overhead calculation.

For an example:

Code: Select all

#define Number (1+1)
#define PI 3.141592543
#define mPI (PI/1000)
I would like Number to be replaced by 2, and mPi to be 0.0031415...

Is it possible ?
And if, how do I check the result that was used in the compilation?


Probably not the most confused programmer anymore on the XCORE forum.