reticulatedpines / magiclantern_simplified

A Git based version of Magic Lantern, for those unwilling or unable to work using Mercurial. The vast majority of branches have been removed, with those thought to be important brought in individually and merged.
GNU General Public License v2.0
142 stars 47 forks source link

Test making imath.h macros into functions #145

Open reticulatedpines opened 2 months ago

reticulatedpines commented 2 months ago

Generally, it's a bad idea to have macros that act like functions. Instead, use functions, and let the compiler optimise. You can force inline if you really want.

imath.h does this a lot. We use these frequently, e.g. MIN(), and we generally care more about size than speed. We use -Os, which is in conflict with macros forcing code to be duplicated.

We should test converting all the function-like macros to functions. How much size does it save, and how much, if any, performance does it cost?