On 11/11/06, Michael Marcin <mmarcin@method-solutions.com> wrote:

...

Finally I'm using this class to replace a lot of hardcoded / macro logic and
often as an optimization the code uses binary shifts to represent power of 2
multiply/divides.  Going forward these divides need to work with both fixed
and floating point types so f >> 1 needs to change to f / 2.  Is it possible
to create an overload for the / and * operators that determine if the
operand is an integral constant and is a power of 2 and use a binary shift
internally?

If, in the end, the thing you are shifting is an integer type, the compiler will do the '/ 2' => '>> 1' substitution for you.  So don't worry about it.

Thanks,

Michael Marcin



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users