I know that if the while loop has this body:
while(a<b){
do_some_calculations
}
it will do calculations and then check the while loop again.But if I have an empty while
loop:
while(a<b) { }
How often it will check the condition?I know that while loop compiles to cmp
and jmp
instructions (which takes from one to two cycles). So it will check while loop every 1-2 cycles?Or not and there are some things I don't know? Detail explanations will be very helpful.
P.S. The question is about the low level details. Please read it more attentively.And I want to know common principles and not "it is compiler dependent and so on".
P.P.S Let's suppose we have some valid condition and compiler generated code for it.HOW OFTEN it will check it?That's the question.