Friday, September 13, 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

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...