Boost logo

Boost :

Subject: Re: [boost] non-branching min()
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-09-11 05:10:29


DE skrev:
> i'd like to present some kind of micro optimization towards pipelined
> cpus
>
> traditionaly min() has an implementation like
>
> template<typename type> inline
> type min(type a, type b) { return a<b ? a : b; }

If you are going to benchmark over several platforms, please include the
technique described here:

http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax

(There is also code for abs()).

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk