Constant Folding

Discuss issues and ideas you have to configuring displays with PowerVision
CustomFP
Posts: 41
Joined: Thu Mar 22, 2012 4:12 pm

Constant Folding

Post by CustomFP » Mon Mar 30, 2015 7:13 pm

Does the Power Vision compiler use Constant folding for operations that contain "const" variables?

Essentially I have a some geometry calculations which, require a large amount of trig operations as well of a regular maths operations. Most of the parameters are constants and many of the operations could be replaced with magic numbers if I wanted to do the calculations with pen and paper before I write the code.

However this would be very bad for the readability of my code. If I leave the operations in the code and declare all of the constants as 'const' will will the compiler simplify these operations to make the code as efficient as if I had done the calculation with pen and paper.
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: Constant Folding

Post by stalley » Wed Apr 01, 2015 8:22 am

Hello CustomPF,

There doesn't seem to be a direct answer in the AngelScript documentation. The assumption is that the code is executed once and stored at startup.
Sara Talley
Software Engineer
Enovation Controls