Follow-up Comment #1, patch #1948 (project freeciv):
I ran M-x rgrep RET _sq( RET on the working directory and found that the vast
majority of functions doing nothing but "squaring" something lie in aiunit.c.
The one replacement with pow() does not exist in a loop and thus really
should not be a major performance hit.
If the use of pow() is unacceptable, I can do two things. I could define a
static inline square() function for just aiunit.c which can be used to
replace the 3 or 4 functions that basically "square" their inputs. Otherwise
I could just "inline" the squaring bit at the call site for this function as
it is used only once.
At a very minimum, the commentary for unit_att_rating_sq should be adjusted
to reflect its very special purpose role of squaring the result of
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list