Is it redundant to check if a modulo operation is needed, then performing it?
If you want to understand what the compiler is doing, you’ll need to just pull up some assembly. I recommend this site (I already entered code from the question)): https://godbolt.org/g/FwZZOb. The first example is more interesting. int div(unsigned int num, unsigned int num2) { if( num >= num2 ) return num % num2; return num; … Read more