Friday, 13 September 2019

c - Greater than('>') VS greater or equal to('>=')

Every time I see people using >= , this question comes to my mind...



Isn't this:




if(x>=15) {}




Slower than this?:




if(x>14) {}




If I were to say(according to my limited knowledge of programming), the former would take 2 CPU cycles in comparison to the latter which would take just 1...



Is it slower, or do compilers optimise these little details? Or perhaps does >= take just 1 CPU cycle?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...