I have been programming a program that tests a value (0<=value<=9)
and checks if it is '0' or not. (if not, it'll be from 1-9)
I would like to know whether ==
or !=
would be faster/better (I believe this would be in the machine code level?), if there is any other efficient way to do this, or if there is no difference at all.
To put in perspective:
if (value == 0)
{
//do something
}
else
{
//do something else
}
Or...
if (value != 0)
{
//do something else
}
else
{
//do something
}
PS: My program repeats this code many times, so even a small difference can affect my program.