On 2018-06-20 16:15, 'Vlad from Moscow' via ISO C++ Standard -
Discussion wrote:
> When I was doing an assignment (See Forming the smallest number
> <
http://cpp.forum24.ru/?1-1-0-00000091-000-0-0-1529414277>. Though the
> topic is written in Russian nevertheless it contains a reference to the
> original question asked at Stackoverflow) I wondered why the function
> *div *does not contain overloads for unsigned integer types. I think it
> would be logically consistent if there were overloads for types unsigned
> int, unsigned long int, and unsigned long long int.
>
There is no real reason anymore for this kind of low level optimization.
Modern compilers will recognize if you compute both quotient and
remainder, and (on an x86 at least) use a single instruction to compute
both values.
Bo Persson