I want to make a small experiment, the purpose of which is to clarify the question of the need to get rid of branches in such functions as min, max, sign and abs. Everyone should be able to take this cpp file (GitHub), compile, run and look at the output in stdout. The program produces two columns of numbers: the time the function works with and without branching. The program can work for a long time, several minutes (do not worry, it does not hang).
Now the program is compiled only in VC ++ 2015 and in GCC 4.8.1 (from MinGW), and I would like it to work in other compilers. Who can advise what to do? I cannot get rid of std::chrono , time needs to be measured more or less universally, int32_t too, since I donโt know, all of a sudden someone will have an int of 64 bits (little). Perhaps I do not follow the Standard in everything or are there any other mistakes?
The important thing is this : I am aware that the code depends on the presence of a sign shift and an additional code in the representation of negative numbers. So it was intended .
-std=c++11option-std=c++11) in Linux. And even there are no warnings from the compiler. - KoVadim