Does mingw optimize multiplication/division by one? That is, if I write
orCode:ONE * a
orCode:a * ONE
, will it be optimized to justCode:a / ONE
? Here, ONE is either a define or a const that is set to one. Also, does it depend on whether a is a float type or not? If a is an integer, ONE is of course also an integer.Code:a
The reason I'm wondering is because I have many expressions that contain a variable that may or may not be set to one, depending on a compile time flag. If the expressions are not optimized when the variable is set to one, I would have to write two different versions of each expression, one for each value (0 or 1) of the flag, and optimize the expressions manually.