[preprocessor] ADD efficiency / documentation?

This documentation is self-contradictory: http://www.boost.org/doc/libs/1_35_0/libs/preprocessor/doc/ref/add.html "This macro is the most efficient when x is less than or equal to y. However, the efficiency gain is not worth actually comparing the two arguments prior to invocation. In other words, x should be the addend that is most likely to be the largest of the two operands." The first sentence says we want (x <= y); the last sentence says we want (x > y). Which is it? :-) -Isaac

AMDG Isaac Dupree wrote:
This documentation is self-contradictory:
http://www.boost.org/doc/libs/1_35_0/libs/preprocessor/doc/ref/add.html
"This macro is the most efficient when x is less than or equal to y. However, the efficiency gain is not worth actually comparing the two arguments prior to invocation. In other words, x should be the addend that is most likely to be the largest of the two operands."
The first sentence says we want (x <= y); the last sentence says we want (x > y). Which is it? :-)
The algorithm is while(y) { ++x; --y; } So the latter is correct. In Christ, Steven Watanabe
participants (2)
-
Isaac Dupree
-
Steven Watanabe