11 Nov
2005
11 Nov
'05
5:48 p.m.
On 11/11/05, mental@...3... <mental@...3...> wrote:
Ah, careful with macros. Because FAST_DIVIDE_BY_255 is a macro, the parameters get evaluated multiple times.
I know that, and I fixed one such bug already.
Where exp1 and/or exp2 are complex expressions, this could be much slower than it needs to be, and if they have side-effects, the duplication may also alter the semantics of the code.
Mostly the expressions are simple array accesses, e.g. d[3]
I suspect you will be able to get an additional performance benefit if you convert these macros to inline functions, because their parameters would no longer be getting calculated multiple times.
Tried that too, no tangible benefit
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org