mardi 21 août 2018

which IF statement is more efficient didn't find similar inquiry

i have two variables - key1 , key2 . i want to do the following

if (( key1 equals 7) or (key2 equals 7)) do something

i know this will work :

if( key1&0xF == 7 | key2&0xF == 7)

do something

and also this :

if(key1 == 7 | key2 == 7) {

do something

i tried this but got an error :

if ((key1&0xF || key2&0xF) == 7){

do something

which is the best or is there another option ? i want this loop to be AS FAST AS POSSIBLE , so anything more efficient would help .

Aucun commentaire:

Enregistrer un commentaire